Skip to main content

Save arbitary nested python dicts and objects in redis

Project description

https://cdn.rawgit.com/adnymics/redicts/ebd9808f/docs/logo.svg

A utility package to save arbitrary nested Python dicts and objects in Redis.

rtd travis coverage pypi pep8 gplv3

Usage

This package can be used to save arbitrary values in a hierarchy. Each element of this hierarchy is referenced by a dotted path like this: a.b.c. When saving a nested dictionary, its nested contents automatically get translated to such a dotted path by its string keys:

# `23` can be read by specifying the path "a.b.c":
{
    "a": {
        "b": {
            "c": 23
        }
    }
}

A special feature of this package is concurrent access: It can be safely used from more than one process. The locking implementation is also separated and can be used on its own if desirable. Also, the implementation is clever enough to not require a global lock if changes are done in different parts of the hierarchy.

You can store every object in redicts that works with json.dumps().

Why?

We use redis quite a lot in our day-to-day work and often want to share values between different (micro-)services. This package helps us to do that safely and easily.

Documentation

Documentation can be found on ReadTheDocs:

http://redicts.readthedocs.io/en/latest

Example

If redis is started with default host/port/password, this should work:

>>> from redicts import section
>>> with section("a.b.c") as sec:
...     #  Setting values:
...     sec["my-value"] = 42
...     sec["my-part"] = {"key": "value"}
...
...     # Reading values:
...     sec["my-value"].val()     # => 42
...     sec["my-part.key"].val()  # => "value"

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

redicts-1.0.6.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redicts-1.0.6-py2-none-any.whl (15.5 kB view details)

Uploaded Python 2

File details

Details for the file redicts-1.0.6.tar.gz.

File metadata

  • Download URL: redicts-1.0.6.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12

File hashes

Hashes for redicts-1.0.6.tar.gz
Algorithm Hash digest
SHA256 97b46e3bfe437608fe64d765ed0a8ce4a7a159bcaa97a89c86a1d70beb288f7c
MD5 d520de870f73314b808e9581dcea4872
BLAKE2b-256 d156551968bbbedbfd268d0beb0e8365da8aeeda25b6d3ae34cccbdf18f2d64f

See more details on using hashes here.

File details

Details for the file redicts-1.0.6-py2-none-any.whl.

File metadata

  • Download URL: redicts-1.0.6-py2-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/20.7.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.12

File hashes

Hashes for redicts-1.0.6-py2-none-any.whl
Algorithm Hash digest
SHA256 e8fde689f72b3912af08fb4ba8ee0448d228e68eaaf96ca8050920563891769e
MD5 23ba223293120b14d10796b4c9725034
BLAKE2b-256 c47d83ecae0ada38f0c579f990f970d2705dfbe256cbccc704d689b2a58e0670

See more details on using hashes here.

Supported by

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