Skip to main content

NamedRedis by Ouroboros Coding

pypi version MIT License

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 package and returns an instance of StrictRedis.

Using

example.py

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

{
	"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

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

Release files for namedredis 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for namedredis 1.0.2
File Size Uploaded
namedredis-1.0.2.tar.gz 3.9 kB Details

Release files / namedredis-1.0.2.tar.gz

Download URL namedredis-1.0.2.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
5d1a451e3731cfe26a8b714dbf14641306c5501f4d7fd4d0736ae3e38ee89aa6
BLAKE2b-256 checksum
How to use checksums
e1dc1b9e468f68a52ad8d5d46efb7fd9c5dd892d2f1f8e73b2d10cb0f55fdd6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.31.0 rfc3986/1.5.0 tqdm/4.65.0 urllib3/1.26.5 CPython/3.10.12

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page