Skip to main content

Hash interface for redis-py

Project description

Hash interface for redis-py

Installation

pip install redis redis_hash

Usage

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)
1
>>> for k, v in redis_hash:
...     print(k, v)
...
foo bar
>>> redis_hash['foo']
b'bar'
>>> list(redis_hash)
[(b'foo', b'bar')]
>> del redis_hash['foo']
>> len(redis_hash)
0

Project details


Download files

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

Source Distribution

redis-hash-0.1.0.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file redis-hash-0.1.0.tar.gz.

File metadata

  • Download URL: redis-hash-0.1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for redis-hash-0.1.0.tar.gz
Algorithm Hash digest
SHA256 095c8b0e7841db1a794011dd04ef16392ac2489340fa83c7a67a5e28346e80b3
MD5 5732c49423f81cca55599483bf353ec0
BLAKE2b-256 d40dc625a70715209a2ae2683e3bb3efeb649bdae4f82423959766e0789d237e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page