Giter Site home page Giter Site logo

rediswrapper's Introduction

Redis Wrapper

rediswrapper is a pythonic wrapper of Redis Client for end users. The whole storage acts like a python dict as well as its child storage values.

Features

  • The root client support dict-like operations
  • Python object wrappers for list, set, hash type values
  • Implicit serialization and deserialization when storing and fetching data

Installation

From PyPI:

pip install rediswrapper

From GitHub:

git clone https://github.com/frostming/rediswrapper
cd rediswrapper
pip install .

Usage

rediswrapper will try to serialize non-sting values and store them in redis and deserialize them when fetching back.

All redis value types are mocked with respective python objects and support all standard methods as the builtin types.

>>> import rediswrapper
>>> redis = rediswrapper.RedisDict()
# String value
>>> redis['a'] = 'hello'
# int value
>>> redis['b'] = 2
>>> dict(redis)
{'a': 'hello', 'b': 2}
# Picklable object
>>> import datetime
>>> redis['c'] = datetime.datetime.now()
# List value
>>> redis['d'] = list(range(5))
>>> redis['d'].append(0)
>>> redis['d']
ListType value([0, 1, 2, 3, 4, 0])
# Hash value
>>> redis['e'] = {'a': 1, 'b': 2}
>>> redis['e'].get('a')
1
# Set value
>>> redis['f'] = set([1, 2])
>>> redis['f'].add(3)
>>> redis['f']
SetType value([1, 2, 3])

To inspect those value types, one should use the ABCs defined in collections module.

>>> from collections import Mapping
>>> isinstance(redis['e'], Mapping)
True

History

v0.4.0
  • Drop support for Python older than 3.6
v0.3.0
  • Drop support for Python 3.3
  • Fix a vulnerability issue that cause users run arbitrary scripts.

Licensing

This work is open-sourced under the MIT license.

rediswrapper's People

Contributors

0x2b3bfa0 avatar frostming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rediswrapper's Issues

python3.9 -> PyPi

Hi, could you please push the release with python3.9 support to PyPi?

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.