Pythonic wrapper for Redis Client.
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rediswrapper-0.4.0.post1.tar.gz
.
File metadata
- Download URL: rediswrapper-0.4.0.post1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.3.4 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de1920cfaacb4c6d5b7fb57409aa49b2a68cc23b773277bda952a5f19b7e7163 |
|
MD5 | e9d1ed229a997c6a9c2d03b701df1109 |
|
BLAKE2b-256 | 9cfbb38f2699c95f206948e53aacb061e62212767b607baa4324c70839596fb4 |
File details
Details for the file rediswrapper-0.4.0.post1-py3-none-any.whl
.
File metadata
- Download URL: rediswrapper-0.4.0.post1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.3.4 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3169528602ee2ca0f504876e5ad10ae36dd9077b67673480f49551e3cb281808 |
|
MD5 | e5c245dbe2f12b7ccc0855dcdb0cf422 |
|
BLAKE2b-256 | 803cf8304fb2a82bd1d28d87a2895c96c9b3454f18ae33baf620834835298891 |