Skip to main content

Pythonic wrapper for Redis Client.

Project description

https://img.shields.io/pypi/v/rediswrapper.svg https://img.shields.io/pypi/pyversions/rediswrapper.svg https://travis-ci.org/frostming/rediswrapper.svg?branch=master https://coveralls.io/repos/github/frostming/rediswrapper/badge.svg?branch=master

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
python setup.py 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.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.

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

rediswrapper-0.3.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

rediswrapper-0.3.0-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file rediswrapper-0.3.0.tar.gz.

File metadata

  • Download URL: rediswrapper-0.3.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for rediswrapper-0.3.0.tar.gz
Algorithm Hash digest
SHA256 08bb42f99453c6939bb27ecaba911a0cb4d9910ca6b3524942d4856fd425f627
MD5 304f8e4131ac8db6ed01a835837357a0
BLAKE2b-256 eb4cf5121ffb85c71018d3df744e7552e191111ba6d611aa634bf62ced7cf2d6

See more details on using hashes here.

File details

Details for the file rediswrapper-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: rediswrapper-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for rediswrapper-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f70698f8c61bfbb721b3cbf6bc22641e4f2f1756f1f9cd2fe5acec098ed5f37c
MD5 99d17033d72e3549994e470b5b2337f8
BLAKE2b-256 7d9b84a7cd2b8901b7336e9b5f0f48920cb6657b80cba9d02283736834f1f64a

See more details on using hashes here.

Supported by

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