Registry / devops / ring
library0.10.1pypypi✓ verified 86d ago

Function-oriented cache interface with built-in memcache, redis, and asyncio support. Current version 0.10.1 provides a decorator-based caching layer, including features like key templating, TTL, and serialization. Release cadence is irregular.

pip install ring
INSTALL
IMPORT
SIG · RING
R
ring
devopspythonv0.10.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ring
import ring

Simple example using the built-in dict cache.

import ring from ring import key # Define a cached function using dict backend @ring.dict({}) def get_data(arg): return arg * 2 print(get_data(21)) # 42 print(get_data(21)) # cached, no recomputation
Debug
Known issues
deprecatedThe `@ring.memo` decorator is deprecated as of 0.10.0. Use `@ring.dict` or other backends instead.
fix
Replace `@ring.memo` with `@ring.dict({})` or the appropriate backend.
affects: >=0.10.0
breakingIn version 0.8.0, the import path changed from `ring.memo` to `ring.dict`. Older code using `import ring.memo` will break.
fix
Use `from ring import key` and `@ring.dict({})`.
affects: >=0.8.0
gotchaWhen using async functions, the backend must support asyncio. The default `dict` backend works, but for Redis you need `ring.redis` with asyncio support.
fix
For async, ensure you use an async-compatible backend like `ring.redis.client.aioredis_client`.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'memo' from 'ring'
The `memo` submodule was removed in ring 0.8.0.
fix
Use `import ring` and then `@ring.dict({})` instead of `@ring.memo`.
TypeError: unsupported operand type(s) for +: 'int' and 'str'
Incorrect key template resulting in mixing types.
fix
Ensure key template uses only strings or proper formatting: `@ring.dict({}, key='/cache/{}')` where `{}` is replaced by a string argument.
ring.exceptions.BackendError: Backend does not support async
Using a synchronous backend (e.g., `ring.redis`) in an async context.
fix
Use an async-capable backend: `ring.redis.client.aioredis_client` or `ring.dict({})`.
Upgrade
Version history
0.10.1latest on PyPI · released Mar 30, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
ring — pip install ring · libregistry