All objects are created through an instance of the Rediset
class.
>>> from rediset import Rediset >>> rs = Rediset()
You can optionally provide a key_prefix
argument to the constructor,
which will be prepended to all keys Rediset generates. This is useful for
namespacing your data in Redis.
>>> from rediset import Rediset >>> rs = Rediset(key_prefix='myprefix')
If you need to customise things further, you can override the Redis client instance Rediset uses:
>>> from rediset import Rediset >>> from redis import Redis >>> r = Redis(host='localhost', port=6379, db=0) >>> rs = Rediset(key_prefix='myprefix', redis_client=r)
The following paragraphs describe advanced information about the behaviour of Rediset that may not make sense until you have read the rest of this documentation.
As of Rediset 0.6.0, all keys automatically generated by Rediset (to store the results of operations) will be prefixed with "rediset". This means you can safely use Rediset without a custom key prefix (to operate on Redis sets that already exist) without polluting your namespace.
Keys which are generated by Rediset can be quite large, as (by default) they
contain a human-readable description of the operation whose results they
represent. To mitigate this, Rediset can MD5 hash all of the keys it generates.
To enable this, pass hash_generated_keys=True
to the Rediset
constructor.