https://github.com/pyapp-org/pyapp.redis
Redis Extension
https://github.com/pyapp-org/pyapp.redis
Last synced: about 2 months ago
JSON representation
Redis Extension
- Host: GitHub
- URL: https://github.com/pyapp-org/pyapp.redis
- Owner: pyapp-org
- License: other
- Created: 2019-05-29T08:40:05.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-09T13:21:50.000Z (about 7 years ago)
- Last Synced: 2025-10-26T21:45:29.302Z (9 months ago)
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
#############
pyApp - Redis
#############
*Let us handle the boring stuff!*
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/ambv/black
:alt: Once you go Black...
This extension provides a `Redis` client factory to allow configuration to be
configured via pyApp settings.
The extension also provides checks to confirm the settings are correct and that
the application is able to connect to the redis instance.
It is strongly recommended to install the `hiredis` companion package to improve
the performance of the redis client.
Installation
============
Install using *pip*::
pip install pyapp-redis
Install using *pipenv*::
pipenv install pyapp-redis
Add the `REDIS` block into your runtime settings file::
REDIS = {
"default": {
"url": "redis://user:pass@host:port/1",
},
}
.. note::
The URL is a defined by Redis client see the
`documentation `_.
In addition to the url any argument that can be provided to `Redis.from_url` can be provided.
Usage
=====
The following example creates a `Redis` client instance::
from pyapp_ext.redis import get_client
# Get connection
redis = get_client()
redis.set("foo")
API
===
`pyapp_ext.redis.get_client(default: str = None) -> Redis`
Get named `Redis` client instance