Caching library with support for multiple cache backends


Keywords
cache, async-cache, asynchronous, cache-decorators, caching, django-cache, dummy-cache, memory-cache, pypi-package, python-library, python-package, redis-cache, synchronous
License
Apache-2.0
Install
pip install cachetory==3.3.0

Documentation

Cachetory

PyPI Python versions Checks Coverage Code style

Documentation

Documentation

Sneak peak

from cachetory import serializers
from cachetory.backends import async_ as async_backends
from cachetory.caches.async_ import Cache


cache = Cache[int, bytes](
    serializer=serializers.from_url("pickle://?pickle-protocol=4"),
    backend=async_backends.from_url("redis://localhost:6379"),
)

async def main() -> None:
    await cache.set("foo", 42)
    assert await cache.get("foo") == 42