Yet another dictionary backed by Redis DB
Project description
persistentdict
Yet another [1] dictionary backed by Redis DB.
We use Redis` 'hash' type [2] and store whole dictionary in one hash.
Usage:
from persistentdict.dict_in_redis import PersistentDict
db = PersistentDict(hash_name="my-persistent-dict")
# add key to the db with a value
db['key'] = value
# show whole dictionary
print(db)
# iterate over keys & values in db
for key, value in db.items():
do_something(key)
# do sth with key if it is in db
if key in db:
do_something(key)
# delete key from db
del db['key']
Installation:
pip3 install persistentdict
[1] Alternatives: persistent-dict, durabledict
[2] https://redis.io/topics/data-types-intro#hashes is basically Python's dict, but values can be strings only, so we use json serialization
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
persistentdict-1.0.1.tar.gz
(6.7 kB
view hashes)
Built Distribution
Close
Hashes for persistentdict-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e768ddd195ac9b9fb8fb0b6a3ebca477e13a8168d6a6cb03f5d381bc7a7c681c |
|
MD5 | 9bbaa4288a3fdc6a1048d585afa6ec4c |
|
BLAKE2b-256 | 2ab6c3c6f9927482652d4896e6fe71499f49458bd75f180d7f6e31db5b6420c8 |