litestar-caching

Installation
SKILL.md

Caching

Execution Workflow

  1. Identify handlers whose responses are deterministic, expensive, and safe to replay.
  2. Choose the route-level cache mode: cache=True, an explicit TTL in seconds, or CACHE_FOREVER.
  3. Set app-level ResponseCacheConfig for default_expiration, store selection, and global key/filter behavior.
  4. Design cache keys around every dimension that changes the payload: path, query params, method, tenant, locale, auth scope, feature flags, or headers.
  5. Decide how stale data is controlled for mutable resources: short TTL, explicit delete, or versioned keys.
  6. Verify hits, misses, and stale-data behavior with tests before treating the cache as production-safe.

Core Rules

  • Cache only responses that are safe to reuse for another equivalent request.
  • Prefer short, explicit TTLs for mutable data.
  • Treat cache=True as "use ResponseCacheConfig.default_expiration", not as "cache forever."
  • Use CACHE_FOREVER only for truly immutable or explicitly versioned resources.
  • Never cache personalized or permission-scoped responses unless the cache key fully partitions that context.
  • Keep key builders deterministic and stable across processes.
Related skills

More from alti3/litestar-skills

Installs
16
GitHub Stars
5
First Seen
Mar 2, 2026