Re: Atomic test/set/get using django cache API?

2013-05-14 Thread Shawn Milochik
I love and recommend Redis. If you can use a Redis key instead of Django's cache, you can call get() on the key. If the result is not None, now you have it. If it is None, you know it didn't exist, so you can set it. I don't think it's possible to have it work the way you want with the default

Atomic test/set/get using django cache API?

2013-05-14 Thread Roy Smith
I want to do an atomic "test and set if doesn't exist" on a cache key using the django API. So far, that's easy.; cache.add() gives me exactly that. But, if the key does exist, I also want to get the current value. All add() gives me back is a flag saying if the key existed. Is there a way