Problem
@cache.local() exists in the local development branch (0.6.0) but isn't in the PyPI release (0.4.0). The only way to do L1-only caching with sync invalidation is @cache.local(), but consumers on the released version can't use it.
@cache(backend=None) is the documented alternative, but it brings the full FeatureOrchestrator (circuit breakers, backpressure, Redis-oriented invalidation machinery) — all dead weight for a pure in-memory LRU use case. Worse, it makes invalidate_cache() async (see #3) and cache_clear() raises TypeError for async functions.
Expected
@cache.local() should be available in the next PyPI release. It provides:
- Simple
ObjectCache (dict-based LRU)
- Sync
cache_clear() — works for both sync and async decorated functions
- Sync
invalidate_cache() — per-key invalidation
- No Redis, no circuit breakers, no
FeatureOrchestrator
Context
Discovered while integrating CacheKit into a FastAPI + Firestore API. The API has async route handlers that read from Firestore. @cache(backend=None) works for caching but invalidation requires await everywhere because the full wrapper maps invalidate_cache to ainvalidate_cache for async functions. @cache.local() is the right tool but it's not released.
Workaround
Install from source: uv add cachekit@/path/to/cachekit-py
Problem
@cache.local()exists in the local development branch (0.6.0) but isn't in the PyPI release (0.4.0). The only way to do L1-only caching with sync invalidation is@cache.local(), but consumers on the released version can't use it.@cache(backend=None)is the documented alternative, but it brings the fullFeatureOrchestrator(circuit breakers, backpressure, Redis-oriented invalidation machinery) — all dead weight for a pure in-memory LRU use case. Worse, it makesinvalidate_cache()async (see #3) andcache_clear()raisesTypeErrorfor async functions.Expected
@cache.local()should be available in the next PyPI release. It provides:ObjectCache(dict-based LRU)cache_clear()— works for both sync and async decorated functionsinvalidate_cache()— per-key invalidationFeatureOrchestratorContext
Discovered while integrating CacheKit into a FastAPI + Firestore API. The API has async route handlers that read from Firestore.
@cache(backend=None)works for caching but invalidation requiresawaiteverywhere because the full wrapper mapsinvalidate_cachetoainvalidate_cachefor async functions.@cache.local()is the right tool but it's not released.Workaround
Install from source:
uv add cachekit@/path/to/cachekit-py