Declarative cache invalidation for Python
Project description
t87s
Declarative cache invalidation for Python.
Install
pip install t87s # Core + MemoryAdapter
pip install t87s[redis] # + Redis support
pip install t87s[all] # Everything
Quickstart
from t87s import QueryCache, TagSchema, Wild, AsyncMemoryAdapter, cached
class MyTags(TagSchema):
users: Wild[TagSchema]
class MyCache(QueryCache[MyTags]):
@cached(MyTags.users())
async def get_user(self, id: str) -> dict:
return await db.users.find_by_id(id)
cache = MyCache(adapter=AsyncMemoryAdapter())
# Cache miss, fetches from DB
user = await cache.get_user("123")
# Cache hit, instant
again = await cache.get_user("123")
# Invalidate when data changes
await cache.invalidate(cache.t.users("123"))
# Cache miss again, refetches
fresh = await cache.get_user("123")
Docs
Full documentation: https://docs.t87s.dev
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
t87s-0.1.0.tar.gz
(78.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
t87s-0.1.0-py3-none-any.whl
(17.3 kB
view details)
File details
Details for the file t87s-0.1.0.tar.gz.
File metadata
- Download URL: t87s-0.1.0.tar.gz
- Upload date:
- Size: 78.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a897dc20c0c5a43af746773b7e36e809530309c5d1a5863040bc9cc7c40f247
|
|
| MD5 |
70dfb4f412f86091af9474a71ecb4bf3
|
|
| BLAKE2b-256 |
e3859c8e1e3253b8377577fa9b7aa4fc594a9b4af0ea08755cce0a5e9ee93568
|
File details
Details for the file t87s-0.1.0-py3-none-any.whl.
File metadata
- Download URL: t87s-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Pop!_OS","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f6601e73017b1d8d887ddcc4124a165dac1387ea5f15356598842279b135e07
|
|
| MD5 |
25719c21fd0e3a0be095cb9e4e50e96c
|
|
| BLAKE2b-256 |
619f6a68a9cb61303e2cd406a605db7aff95def138a59df326699967cb577e8e
|