Skip to main content

A Redis-backed persistent Python dictionary

Project description

redis-json-dict

Actions Status Documentation Status

PyPI version Conda-Forge PyPI platforms

GitHub Discussion

Usage

>>> import redis
... redis_client = redis.Redis("localhost", 6379)
... d = RedisJSONDict(redis_client, prefix="my_dict")
... d
{}

All user modifications, including mutation of nested lists or dicts, are immediately synchronized to the Redis server.

Design Requirements

  • The dictionary implements Python's collections.abc.MutableMapping interface.
  • All values stored in Redis are JSON-encoded, readily inspected with developer eyeballs and possible to operate on from clients in languages other than Python.
  • Keys may be prefixed to reduce the likelihood of collisions when one Redis is shared by multiple applications.
  • No data is cached locally, so it is impossible to obtain a stale result. However, the dictionary may be composed with other libraries, such as cachetools, to implement TTL caching for example.
  • Top-level items like d['sample'] may be accessed without synchronizing the entire dictionary. Nested objects like d['sample']['color'] are supported (but may be less efficient).
  • Mutating nested items, with operations like d['sample']['color'] = 'red' or d['sample']['positions'].append(3) triggers synchronization.

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_json_dict-0.2.1.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

redis_json_dict-0.2.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file redis_json_dict-0.2.1.tar.gz.

File metadata

  • Download URL: redis_json_dict-0.2.1.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for redis_json_dict-0.2.1.tar.gz
Algorithm Hash digest
SHA256 27db0913b6eac9f6087d0bea903a33be387d9d03e5d097e9c6435b481dd248c2
MD5 aa6a8b4a9f32ec8e115805d3a03db7c9
BLAKE2b-256 e819628c1985d8f1df08bbcaaf7e234c83a711d9685ad3bfa06c0b8cac744fd1

See more details on using hashes here.

File details

Details for the file redis_json_dict-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for redis_json_dict-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2f4329fc5e1f5e5335e13e2f8c082cbdb43c35a1490aa7f8370a8eacccd8ccb1
MD5 61ced9cdfffca2ae2f216de55cb0e575
BLAKE2b-256 9963d30abf8b53c6ceaea2e7d8d766363a6a2e6a6b7f2238e3ae56e882a4dc21

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