Code Monkey home page Code Monkey logo

redis-json-dict's Introduction

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.

redis-json-dict's People

Contributors

junaishima avatar danielballan avatar hyperrealist avatar mrakitin avatar dependabot[bot] avatar kezzsim avatar

Watchers

 avatar  avatar  avatar Garrett Bischof avatar  avatar Eugene avatar  avatar

redis-json-dict's Issues

Revisit test fixtures

Things to consider:

  • Ensure that Redis is cleaned up. (Maybe this is already done, just needs a review.)
  • Instead of spawning Redis in a subprocess, expect an env var that specifies the URI of a Redis instance that can be used for testing.

instantiate with just the hostname

the user should not need to create a redis client connected to the desired host. this would simplify the instantiation.

d = RedisJSONDict("hostname", prefix="mymetadata")

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.