Declarative caching for the Pico ecosystem: @cacheable AOP with pluggable backends.
Project description
📦 pico-caching
Declarative method caching for the Pico ecosystem: @cacheable over pico-ioc method interception, pluggable backends, auto-discovered by pico-boot. Zero-config.
Install
pip install pico-caching
Use
from pico_ioc import component
from pico_caching import cacheable
@component
class UserRepo:
@cacheable(ttl_seconds=60)
async def find(self, user_id: int): ...
@cacheable(key=lambda q: f"search:{q}")
def search(self, q: str): ...
Sync and async (the awaited result is cached, never the coroutine). Default backend: thread-safe in-memory LRU with per-entry TTL (cache.max_entries, cache.default_ttl_seconds). Bring your own backend by implementing the CacheBackend protocol as a @component — it replaces the built-in automatically.
# application.yaml (optional)
cache:
default_ttl_seconds: 300
max_entries: 1024
Skipped for now: @cache_evict and a Redis backend — planned once real usage asks for them.
Documentation
Full docs at dperezcabrera.github.io/pico-caching.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file pico_caching-0.1.0.tar.gz.
File metadata
- Download URL: pico_caching-0.1.0.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2164d61a4089b8f091ff208cf27ce79d9c861c17ed6289fad564fd3f967a843e
|
|
| MD5 |
19a811ca555dc53342214ad8583f6f9d
|
|
| BLAKE2b-256 |
ca316c76d9827f72621ecacfb3ef0b248bcdc4a3fc2af0134e6869b5dbc96a01
|
Provenance
The following attestation bundles were made for pico_caching-0.1.0.tar.gz:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-caching
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_caching-0.1.0.tar.gz -
Subject digest:
2164d61a4089b8f091ff208cf27ce79d9c861c17ed6289fad564fd3f967a843e - Sigstore transparency entry: 2071340391
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-caching@0371d292c577375653beb97ef06543a62be28345 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@0371d292c577375653beb97ef06543a62be28345 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pico_caching-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pico_caching-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4dc9348701a3438ffeffe9ddd4d87a9305d50ad920cb864bff4ecfa6d9dfc4bf
|
|
| MD5 |
57591eb2f0b4b705ac4547fb7f52b0d9
|
|
| BLAKE2b-256 |
8ebcfe8a412d139c36d72a4110222653ea50d6c4a2324473a7ac014e147609e3
|
Provenance
The following attestation bundles were made for pico_caching-0.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on dperezcabrera/pico-caching
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pico_caching-0.1.0-py3-none-any.whl -
Subject digest:
4dc9348701a3438ffeffe9ddd4d87a9305d50ad920cb864bff4ecfa6d9dfc4bf - Sigstore transparency entry: 2071340483
- Sigstore integration time:
-
Permalink:
dperezcabrera/pico-caching@0371d292c577375653beb97ef06543a62be28345 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dperezcabrera
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@0371d292c577375653beb97ef06543a62be28345 -
Trigger Event:
release
-
Statement type: