Skip to content

cache.local() not available in 0.4.0 release #109

@27Bslash6

Description

@27Bslash6

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions