advanced-alchemy-caching

- Identify deterministic read paths in repositories or services before adding any caching layer.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "advanced-alchemy-caching" with this command: npx skills add alti3/litestar-skills/alti3-litestar-skills-advanced-alchemy-caching

Caching

Execution Workflow

  • Identify deterministic read paths in repositories or services before adding any caching layer.

  • Keep query filters and loader options stable so identical reads stay cacheable.

  • For custom SQLAlchemy types, ensure constructor state is hashable and safe for statement caching.

  • Use framework-level response caching only for read paths with explicit freshness and invalidation expectations.

  • Revisit write paths so updates invalidate, bypass, or tolerate stale cached reads.

Implementation Rules

  • Treat caches as derived data, never as the source of truth.

  • Avoid caching reads that depend on implicit session state or nondeterministic defaults.

  • Do not enable cacheable custom types unless their public constructor state is stable and hashable.

  • Separate SQLAlchemy statement caching concerns from HTTP response caching concerns.

Example Pattern

class LookupType(TypeDecorator): cache_ok = True

def __init__(self, lookup: dict[str, int]) -> None:
    self._lookup = lookup
    self.lookup = tuple((key, lookup[key]) for key in sorted(lookup))

Validation Checklist

  • Confirm repeated queries actually generate stable SQL and parameters.

  • Confirm custom types do not emit SQLAlchemy cache warnings.

  • Confirm cached responses are invalidated or freshness-bounded after writes.

  • Confirm no personalized or tenant-specific data leaks across cache keys.

Cross-Skill Handoffs

  • Use advanced-alchemy-repositories and advanced-alchemy-services to make read paths deterministic first.

  • Use advanced-alchemy-types when cacheability problems come from custom types.

  • Use litestar-caching if a Litestar app needs route-level response caching above Advanced Alchemy.

Advanced Alchemy References

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

litestar-caching

No summary provided by upstream source.

Repository SourceNeeds Review
General

litestar-logging

No summary provided by upstream source.

Repository SourceNeeds Review
General

litestar-requests

No summary provided by upstream source.

Repository SourceNeeds Review
General

litestar-databases

No summary provided by upstream source.

Repository SourceNeeds Review