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

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.

Files for redicts, version 1.0.6
Filename, size File type Python version Upload date Hashes
Filename, size redicts-1.0.6-py2-none-any.whl (15.5 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size redicts-1.0.6.tar.gz (12.7 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