In-memory stores¶
The simplest conceivable key-value store is found in
simplekv.memory.DictStore
. It lends itself well for testing or
playing around with simplekv.
-
class
simplekv.memory.
DictStore
(d=None)¶ Store data in a dictionary.
This store uses a dictionary as the backend for storing, its implementation is straightforward. The dictionary containing all data is available as d.
-
iter_keys
(prefix=u'')¶ Return an Iterator over all keys currently in the store, in any order. If prefix is not the empty string, iterates only over all keys starting with prefix.
Raises: exceptions.IOError – If there was an error accessing the store.
-
redis-backend¶
The redis-backend requires redis
to be installed and uses a
redis-database as a backend.
Currently, simplekv targets the latest stable redis version, but since it uses very few commands available, it should work on older stables as well. Note that some features are unsupported on older redis-versions (such as sub-second accuracy for TTL values on redis < 2.6) and will cause redis to complain.
-
class
simplekv.memory.redisstore.
RedisStore
(redis)¶ Uses a redis-database as the backend.
Parameters: redis – An instance of redis.StrictRedis
.