Skip to content

Releases: dperezcabrera/pico-caching

pico-caching v0.1.1

Choose a tag to compare

@dperezcabrera dperezcabrera released this 04 Jul 15:59

pico-caching v0.1.1

Config prefix consistency release. No functional changes.

Changed

  • The configuration prefix is now caching (was cache), matching the ecosystem rule that the prefix equals the package name suffix (pico-actuator -> actuator:, pico-resilience -> resilience:, pico-caching -> caching:). A uniform rule is guessable-correct; with zero-config defaults, a wrongly guessed prefix is silently ignored rather than an error, so the exception was a misconfiguration trap.
# before (0.1.0)          # after (0.1.1)
cache:                    caching:
  default_ttl_seconds: 60   default_ttl_seconds: 60

Compatibility

  • Breaking only for application.yaml files written against 0.1.0 (published minutes earlier): rename the block.
  • Python 3.11+ · pico-ioc >= 2.2.0

Install

pip install --upgrade pico-caching==0.1.1

pico-caching v0.1.0

Choose a tag to compare

@dperezcabrera dperezcabrera released this 04 Jul 15:46

pico-caching v0.1.0

First public release. Declarative method caching (@cacheable) over pico-ioc interception with pluggable backends, auto-discovered by pico-boot. Zero-config. No prior versions; no migration required.

Highlights

  • @cacheable(ttl_seconds, key=...) on any @component method — sync or async; the awaited result is cached, never the coroutine.
  • Built-in backend: thread-safe in-memory LRU with per-entry TTL (time.monotonic), bounded by cache.max_entries.
  • Bring your own backend: implement the 4-method CacheBackend protocol as a @component and it replaces the built-in automatically — no registry, no config.
  • Repr-based default keys (explicit and debuggable); key=callable for custom keys.
  • Exceptions are never cached; cache.enabled: false bypasses everything.

Deliberately not in v0.1.0

@cache_evict and a Redis backend — planned once real usage asks for them. Invalidate today by injecting the backend (delete/clear).

Example

from pico_ioc import component
from pico_caching import cacheable

@component
class UserRepo:
    @cacheable(ttl_seconds=60)
    async def find(self, user_id: int): ...

Compatibility

  • Python 3.11+ · pico-ioc >= 2.2.0

Tests

  • 5 tests. Pinned behaviors: hit/miss per argument set, TTL expiry, async caches the awaited result (single execution across awaits), enabled: false bypasses, and LRU eviction order in the built-in backend.

Install

pip install pico-caching