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

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.2.1.tar.gz (5.4 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for rediswrapper-0.2.1.tar.gz
Algorithm Hash digest
SHA256 dde0a7344a34f9f8cbb0795a69de90b6fefd6c187af6274bf965fd1b9067dc97
MD5 9b53e79e701d252b957b1cc4f4bd4bec
BLAKE2b-256 4f1296a379b041e40d96cc53ae7912e50dd05dff38b52da532aba9588afeabfa

See more details on using hashes here.

Provenance

Supported by

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