sprockets.clients.redis

Base functionality for accessing/modifying data in Redis

Version Downloads Status Coverage License

Installation

sprockets.clients.redis is available on the Python Package Index and can be installed via pip or easy_install:

pip install sprockets.clients.redis

Requirements

  • consistent_hash==1.0
  • hiredis==0.1.6
  • redis==2.10.3

Simple Example

Simple CRUD operations on a key.

>>> import os
>>> os.environ['REDIS_URI'] = 'redis://localhost/'

>>> shard = ShardedRedisConnection()
<sprockets.clients.redis.ShardedRedisConnection at 0x1046f2c90>

>>> shard.set('foo', 1)
>>> shard.get('foo')
'1'
>>> shard.delete('foo')
>>> value = shard.get('foo')
>>> value is None
True

Setting a TTL on your key.

>>> import os
>>> import time
>>> os.environ['REDIS_URI'] = 'redis://localhost/'

>>> shard = ShardedRedisConnection()
<sprockets.clients.redis.ShardedRedisConnection at 0x1046f2c90>

>>> shard.set('bar', 1, ttl=2)
>>> shard.get('bar')
'1'
>>> time.sleep(2)
>>> value = shard.get('foo')
>>> value is None
True

Version History

See Release History

Contributing

Issues and Pull Requests are always welcome. For more information on how to contribute please refer to How to Contribute.

Issues

Please report any issues to the Github project at https://github.com/sprockets/sprockets.clients.redis/issues

Source

sprockets.clients.redis source is available on Github at https://github.com/sprockets/sprockets.clients.redis

License

sprockets.clients.redis is released under the 3-Clause BSD license.

Indices and tables