Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Hash interface for redis-py

Project description

Simple python interface for redis hash type


pip install redis redis_hash


First you need to instantiate the redis client from the redis package:

>> from redis import StrictRedis
>> redis_client = StrictRedis(host='localhost', port=6379, db=0)

Then create your hash passing the client and the hash key:

>> from redis_hash import RedisHash
>> redis_hash = RedisHash(redis_client, 'hash_name')

Now your can handle your hash like a dict:

>> redis_hash['foo'] = 'bar'
>> len(redis_hash)
>> 'foo' in redis_hash
>>> for k, v in redis_hash:
...     print(k, v)
foo bar
>>> redis_hash['foo']
>>> list(redis_hash)
[(b'foo', b'bar')]
>> del redis_hash['foo']
>> len(redis_hash)
>> 'foo' in redis_hash

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for redis-hash, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size redis-hash-1.0.1.tar.gz (2.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page