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
kpn / cachetory Goto Github PK
View Code? Open in Web Editor NEWCaching library with support for multiple cache backends
Home Page: https://kpn.github.io/cachetory/
License: Apache License 2.0