GithubHelp home page GithubHelp logo

redicts's Introduction

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"

redicts's People

Contributors

quan-z avatar quantum-byte avatar sahib avatar sragatsky avatar urban48 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

urban48

redicts's Issues

Can c hold an array or list?

{
    "a": {
        "b": {
            "c": [[1, 2, 3], [1, 2, 3], [1, 2, 3]]
        }
    }
}

Note that I did not yet check it. Just wanted to know your opinion as you've been using the module for a while.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.