Metadata-Version: 2.4
Name: redisdol
Version: 0.0.4
Summary: redis with a simple (dict-like or list-like) interface
Project-URL: Homepage, https://github.com/i2mint/redisdol
Author: Thor Whalen
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: database,dict-like,dol,key-value,list-like,redis,storage
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: dol
Requires-Dist: redis
Provides-Extra: dev
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: sphinx-rtd-theme>=1.0; extra == 'docs'
Requires-Dist: sphinx>=6.0; extra == 'docs'
Description-Content-Type: text/markdown


# 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.

```python
>>> 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]
>>>
```
