vivekn/redis-simple-cache — pull request #1 by fjsj (2012-10-10 20:33:15+00:00)
Title: Unused keys still in memory

There is a bug in the original implementation of redis-simple-cache. Lines 28 - 29:

connection.spop('SimpleCache:keys')
connection.delete("SimpleCache::%s" % key)

The key to be deleted should be the same key that is popped, otherwise popped keys would still be in memory. If you run the new tests with old lines 28 - 29 they will fail, since `connection.keys("SimpleCache::*")` just keep growing in `test_cache_limit`.

The correct version is:

del_key = connection.spop('SimpleCache:keys')
connection.delete("SimpleCache::%s" % del_key)

Also, added two new useful methods: `keys()` and `flush()`