redis with a simple (dict-like or list-like) interface
Project description
redisdol
redis with a simple (dict-like or list-like) interface
To install: pip install redisdol
Provides a collections.abc.MutableMapping (i.e. dict-like) interface to Redis.
Note that Redis automatically converts everything to bytes when writing, which means that read and write are not inverse of each other in the base RedisPersister. A serialization/deserialization layer can be added to make read and write consistent.
>>> from redisdol import RedisBytesPersister
>>> s = RedisBytesPersister() # plenty of params possible (all those of redis.Redis), but taking defaults.
>>>
>>> # clear the kehys we'll be using
>>> keys = ['_pyst_test_str', '_pyst_test_int', '_pyst_test_float']
>>> for k in keys:
... del s[k]
>>>
>>> before_length = len(s)
>>>
>>> s['_pyst_test_str'] = 'hello'
>>> s['_pyst_test_str'] # note you won't be getting a str but bytes
b'hello'
>>>
>>> '_pyst_test_str' in s
>>>
>>> # numbers are converted to strings then bytes
>>> s['_pyst_test_int'] = 42
>>> assert s['_pyst_test_int'] == b'42'
>>> s['_pyst_test_float'] = 3.14
>>> assert s['_pyst_test_float'] == b'3.14'
>>>
>>> assert len(s) == before_length + 3
>>>
>>> '_pyst_test_float' in
>>>
>>> # clean up
>>> for k in keys:
... del s[k]
>>>
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redisdol-0.0.3.tar.gz.
File metadata
- Download URL: redisdol-0.0.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5301740e97b9d0508e99d6f9c75bf58f21aae34b1ffaccf472c5d2663180de03
|
|
| MD5 |
c62a6b3a533da69b74581ebfdea8f135
|
|
| BLAKE2b-256 |
7ef8f9b804b37c99c2f2cec0f275ce2040fd6a23be3c0bb9fc8fe9c4cf84acd1
|
File details
Details for the file redisdol-0.0.3-py3-none-any.whl.
File metadata
- Download URL: redisdol-0.0.3-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28803983cffcc339c54bc78f6d6bb08a472b1ea2f1cd6fea658972b76551aa97
|
|
| MD5 |
33cb1bf2d3680651b304d1ad07da8c7f
|
|
| BLAKE2b-256 |
753acc6f1fa7ee4063f98374a858f69726e2c285421ad1471fb82f540fbb69f9
|