Metadata-Version: 2.5
Name: standard-cache
Version: 0.2.2
Summary: Async Redis caching and distributed locks for Standard
Project-URL: Documentation, https://appunni-m.github.io/python-standard/cache/
Project-URL: Repository, https://github.com/appunni-m/python-standard
Author: Standard contributors
License-Expression: MIT
License-File: LICENSE
Keywords: cache,locking,redis,standard
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: redis[hiredis]<8,>=5
Requires-Dist: standard==0.2.2
Description-Content-Type: text/markdown

# standard-cache

Redis caching helpers and distributed locks for the `standard` Python library.
The package name is `standard-cache`; Python imports are under `std.cache`.

The source package is built and tested. PyPI availability and publisher setup
for the add-on have not yet been verified.

After the first PyPI release, install it with:

```console
python -m pip install standard-cache
```

```python
from std.cache import RedisClient, RedisConfig, cached

cache = RedisClient(RedisConfig(host="localhost", key_prefix="shop:"))
await cache.connect()


@cached(cache, ttl=300)
async def get_product(product_id: int) -> dict[str, str]:
    return await load_product(product_id)


try:
    product = await get_product(42)
finally:
    await cache.close()
```

`RedisClient` supports JSON-compatible values, raw bytes, expiration, atomic
conditions, key scanning, and prefix-aware deletion. `cached` and `cache_aside`
preserve sync and async function behavior. `DistributedLock` and `with_lock`
provide lease-based locks with token-checked release. See the [cache guide](https://appunni-m.github.io/python-standard/cache/)
for lifecycle, serialization, failure, and locking behavior.
