vivekn / redis-simple-cache

Simple redis based cache for storing results of python function calls, json encoded strings or html.
Other
122 stars 69 forks source link

SimpleCache.store() uses SETEX which cannot accept non-positive values #26

Closed DerekMarshall closed 9 years ago

DerekMarshall commented 10 years ago

SETEX does not support this:

 https://groups.google.com/d/msg/redis-db/DmtcGkZuD10/OZU16j4ZUpkJ

store() could probably include a check for expire=None and simply use SET for those requests.

Have I understood this issue properly? Would you like a patch for this?

vivekn commented 10 years ago

Well, the default value is positive in that case. Since the main purpose is just to cache/memoize results, it wasn't much of a concern. But we could add something like expire=-1 signifying persistent storage.

deybhayden commented 10 years ago

I added a PR that just does a simple if block to call set() instead of setx() - #27.