litestar-caching

Configure Litestar endpoint caching with TTL and invalidation-aware rules.

7|1|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/alti3/litestar-skills --skill litestar-caching
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: litestar-caching
Source: https://github.com/alti3/litestar-skills/tree/main/plugins/litestar/skills/litestar-caching
Command: npx skills add https://github.com/alti3/litestar-skills --skill litestar-caching

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Configure Litestar response caching with route-level cache controls, key design, TTL strategy, and invalidation-aware behavior. Use when optimizing read-heavy endpoints or reducing repeated computation. Do not use for mutable workflows that require immediate consistency unless explicit cache invalidation is designed.

Core Features & Use Cases

  • Route-level caching with TTL and configurable cache keys to segment data by context (tenant, locale, user).
  • Invalidation-aware caching strategy that triggers refresh on relevant write events and data changes.
  • Example patterns and usage with the litestar-caching skill to illustrate safe, reusable caching policies.

Quick Start

Configure a read-heavy endpoint to use route-level caching with a defined TTL and key dimensions.

Frequently Asked Questions about litestar-caching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure route-level caching in Litestar to optimize read-heavy web APIs?

Route-level caching in Litestar optimizes read-heavy web APIs by applying configurable cache keys and TTL management to segment response data by context like tenant or user, ensuring fast response replay for safe endpoints.

What is the best way to handle cache invalidation for Litestar endpoints when data changes?

Cache invalidation for Litestar endpoints is handled via an invalidation-aware strategy that triggers automatic cache refreshes on relevant write events and data changes, maintaining data freshness without requiring immediate consistency for mutable workflows.

Can I use TTL management to control data freshness for cached Litestar responses?

TTL management controls data freshness for cached Litestar responses by defining time-to-live rules on routes where response replay is safe, ensuring stale data is automatically expired and refreshed based on configured time intervals.

When should I avoid using response caching for Litestar web API routes?

You should avoid response caching for Litestar routes within mutable workflows that require immediate consistency, unless you design explicit cache invalidation triggers to handle the write events and data changes.

Does Litestar caching support segmenting cached data by context like tenant or locale?

Litestar caching supports segmenting cached data by context through configurable cache keys, allowing you to isolate response caches by tenant, locale, or user dimensions for read-heavy workloads.