# NamedRedis by Ouroboros Coding
[![pypi version](https://img.shields.io/pypi/v/namedredis.svg)](https://pypi.org/project/namedredis) ![MIT License](https://img.shields.io/pypi/l/namedredis.svg)
Named Redis: a simple wrapper for redis using config-oc to act as a factory for named connections
# Install
```
pip install namedredis
```
# Requires
namedredis requires python 3.10 or higher
# Uses
namedredis uses the [redis](https://pypi.org/project/redis/) package and returns an instance of StrictRedis.
# Using
example.py
```python
from nredis import nr, reset
# Reference every time
nr('main').set('foo', 'bar')
# Store instance for multiple uses
main_redis = nr('main')
main_redis.set('hello', 'world!')
# Re-fetches a config and resets the connection
reset('main')
# Resets all open connections
reset()
```
config.json
```json
{
"redis": {
"main": {
"host": "localhost",
"port": 6379,
"db": 0,
"protocol": 3
},
"secondary": {
"db": 1
}
}
}
```
# Options
The following options all have defaults and don't necessarily need to be set. For more non-standard options, see [redis.StrictRedis](https://redis-py-doc.readthedocs.io/en/master/index.html#redis.StrictRedis)
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| host | str | "localhost" | The IP or host name of the server |
| port | unsigned | 6379 | The port of the server |
| db | unsigned | 0 | The DB to connect to on the server |
| protocol | unsigned | 3 | The protocol version to use |
Raw data
{
"_id": null,
"home_page": null,
"name": "namedredis",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "redis, config",
"author": "Chris Nasr - Ouroboros Coding Inc.",
"author_email": "chris@ouroboroscoding.com",
"download_url": "https://files.pythonhosted.org/packages/e1/dc/1b9e468f68a52ad8d5d46efb7fd9c5dd892d2f1f8e73b2d10cb0f55fdd6b/namedredis-1.0.2.tar.gz",
"platform": null,
"description": "# NamedRedis by Ouroboros Coding\n[![pypi version](https://img.shields.io/pypi/v/namedredis.svg)](https://pypi.org/project/namedredis) ![MIT License](https://img.shields.io/pypi/l/namedredis.svg)\n\nNamed Redis: a simple wrapper for redis using config-oc to act as a factory for named connections\n\n# Install\n```\npip install namedredis\n```\n\n# Requires\nnamedredis requires python 3.10 or higher\n\n# Uses\nnamedredis uses the [redis](https://pypi.org/project/redis/) package and returns an instance of StrictRedis.\n\n# Using\n\nexample.py\n```python\nfrom nredis import nr, reset\n\n# Reference every time\nnr('main').set('foo', 'bar')\n\n# Store instance for multiple uses\nmain_redis = nr('main')\nmain_redis.set('hello', 'world!')\n\n# Re-fetches a config and resets the connection\nreset('main')\n\n# Resets all open connections\nreset()\n```\n\nconfig.json\n```json\n{\n\t\"redis\": {\n\t\t\"main\": {\n\t\t\t\"host\": \"localhost\",\n\t\t\t\"port\": 6379,\n\t\t\t\"db\": 0,\n\t\t\t\"protocol\": 3\n\t\t},\n\t\t\"secondary\": {\n\t\t\t\"db\": 1\n\t\t}\n\t}\n}\n```\n\n# Options\n\nThe following options all have defaults and don't necessarily need to be set. For more non-standard options, see [redis.StrictRedis](https://redis-py-doc.readthedocs.io/en/master/index.html#redis.StrictRedis)\n\n| Name | Type | Default | Description |\n| ---- | ---- | ------- | ----------- |\n| host | str | \"localhost\" | The IP or host name of the server |\n| port | unsigned | 6379 | The port of the server |\n| db | unsigned | 0 | The DB to connect to on the server |\n| protocol | unsigned | 3 | The protocol version to use |\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library to make sharing the same redis connection easier",
"version": "1.0.2",
"project_urls": {
"Source": "https://github.com/ouroboroscoding/namedredis",
"Tracker": "https://github.com/ouroboroscoding/namedredis/issues"
},
"split_keywords": [
"redis",
" config"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e1dc1b9e468f68a52ad8d5d46efb7fd9c5dd892d2f1f8e73b2d10cb0f55fdd6b",
"md5": "9985ce6f2c45c46944e38ca8500f0ea3",
"sha256": "5d1a451e3731cfe26a8b714dbf14641306c5501f4d7fd4d0736ae3e38ee89aa6"
},
"downloads": -1,
"filename": "namedredis-1.0.2.tar.gz",
"has_sig": false,
"md5_digest": "9985ce6f2c45c46944e38ca8500f0ea3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 3865,
"upload_time": "2024-12-14T15:17:12",
"upload_time_iso_8601": "2024-12-14T15:17:12.867761Z",
"url": "https://files.pythonhosted.org/packages/e1/dc/1b9e468f68a52ad8d5d46efb7fd9c5dd892d2f1f8e73b2d10cb0f55fdd6b/namedredis-1.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-14 15:17:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ouroboroscoding",
"github_project": "namedredis",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "namedredis"
}