Stores
Execution Workflow
-
Choose store backend based on durability and latency requirements.
-
Define key schema and namespacing to avoid collisions.
-
Apply TTL policy aligned with product freshness guarantees.
-
Add graceful fallback behavior for transient store outages.
Implementation Rules
-
Keep key naming deterministic and version-safe.
-
Separate namespaces by feature and tenant when applicable.
-
Avoid storing unbounded payload sizes.
-
Treat store values as ephemeral unless durability is guaranteed.
Example Pattern
Pseudocode pattern: define namespaced keys + explicit TTL.
session_key = f"session:{user_id}" await store.set(session_key, value={"uid": user_id}, expires_in=1800)
Validation Checklist
-
Confirm TTL expiration behavior matches expectations.
-
Confirm key collisions do not occur across features.
-
Confirm outage/failure behavior is explicit and tested.
Cross-Skill Handoffs
-
Use litestar-caching for response-level caching strategy.
-
Use litestar-authentication when session/security data is store-backed.
Litestar References