Redisobjects
Simple wrapper for aioredis to provide asynchronous functionality with a clean object-oriented interface for Redis in Python 3.6+.
Installation
pip install redisobjects
Examples
Example showing how to use atoms (defined as single key-value pairs):
import redisobjects
import asyncio
async def main(loop):
redis = await redisobjects.connect('redis://localhost', loop=loop)
atom = redis.atom('example.atom')
print(await atom.get())
await atom.set('bla')
print(await atom.get())
await atom.remove()
print(await atom.get())
redis.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Example that shows how to use a list:
import redisobjects
import asyncio
async def main(loop):
redis = await redisobjects.connect('redis://localhost', loop=loop)
example_list = redis.list('example.list')
print(await example_list.list())
await example_list.push_right('b')
await example_list.push_right('c')
print(await example_list.list())
await example_list.push_left('a')
print(await example_list.list())
await example_list.pop_left()
await example_list.pop_left()
print(await example_list.list())
await example_list.pop_left()
print(await example_list.list())
redis.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Example that shows how to use a dict/map:
import redisobjects
import asyncio
async def main(loop):
redis = await redisobjects.connect('redis://localhost', loop=loop)
d = redis.dict('example.dict')
print(dict(await d.items()))
await d.set('a', '1')
print(dict(await d.items()))
await d.set('b', '2')
print(dict(await d.items()))
await d.set('c', '3')
print(dict(await d.items()))
await d.remove('a', 'b')
print(dict(await d.items()))
await d.remove('c')
print(dict(await d.items()))
redis.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Example that shows how to use transactions:
import redisobjects
import asyncio
async def main(loop):
redis = await redisobjects.connect('redis://localhost', loop=loop)
list = redis.list('example.list')
atom = redis.atom('example.atom')
tx = redis.create_transaction()
await list.push_right('a', 'b', tx=tx)
await atom.set('a', tx=tx)
print(await list.list())
print(await atom.get())
await tx.commit()
print(await list.list())
print(await atom.get())
# Clean up
await list.remove('a')
await list.remove('b')
await atom.remove()
redis.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(main(loop))
loop.close()
Metadata
Release files for redisobjects 0.7.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redisobjects-0.7.8-py3.6.egg | Legacy Egg format | - | - | Details for redisobjects-0.7.8-py3.6.egg |
| redisobjects-0.7.8-py3-none-any.whl | Python 3 | none | any | Details for redisobjects-0.7.8-py3-none-any.whl |
Total release size: 52.8 kB
Release files / redisobjects-0.7.8-py3.6.egg
| Download URL | redisobjects-0.7.8-py3.6.egg |
|---|---|
| Size | 36.7 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
7f70a77be1d9f462f08a96eec2aa557865decee31b5f92bac8795b9c8d56e00a
|
|
BLAKE2b-256 checksum How to use checksums |
2a8259b6c2a55faddb95d78e276e3ccf7780566ad15c64171acb9898bd061ced
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9
|
Release files / redisobjects-0.7.8-py3-none-any.whl
| Download URL | redisobjects-0.7.8-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bc0160a51e90efdb0d1d93ccb295fd9d0eaabf9beede328e3113b0d58324a99e
|
|
BLAKE2b-256 checksum How to use checksums |
efa1f7e09248dbcd0ccc220d7be2cbebe97b337c786a832ae1e7f94ea39ad1cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9
|
Security for redisobjects 0.7.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.