caching

Wrap existing repository adapters with Redis-backed caching and mutation invalidation.

1|Updated Jan 13, 2023
One-click install
npx skills add https://github.com/theodrosyimer/.dotfiles --skill caching-theodrosyimer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching
Source: https://github.com/theodrosyimer/.dotfiles/tree/main/claude/skills/infra__caching
Command: npx skills add https://github.com/theodrosyimer/.dotfiles --skill caching-theodrosyimer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Caching solves the problem of repeated reads and expensive recomputation by introducing a layered caching strategy that preserves data correctness while boosting performance.

Core Features & Use Cases

  • Implement Redis-backed caching adapters wrapping existing ports (repositories, API clients)
  • Configure HTTP Cache-Control headers and client-side caching strategies
  • Enable distributed invalidation via Redis client tracking and staged invalidation

Quick Start

Wrap an existing repository with a Redis-backed cached adapter and validate that cache entries are invalidated on mutations

Frequently Asked Questions about caching

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

FAQPage Schema
How do I implement Redis caching for existing NestJS repository adapters?

Implement Redis caching for NestJS repository adapters by wrapping existing ports with a Redis-backed cached adapter. This introduces a layered caching strategy that preserves data correctness while reducing repeated reads and expensive recomputation across your infrastructure.

How does distributed cache invalidation work when using Redis?

Distributed cache invalidation uses Redis client tracking to monitor data mutations across services. When a write operation occurs, the system executes staged invalidation to automatically remove or update stale cache entries, ensuring data consistency without manual cleanup.

What is the best way to configure frontend caching alongside a Redis backend?

Configure frontend caching alongside a Redis backend by utilizing HTTP Cache-Control headers and integrating TanStack Query. This combined approach enables selective client-side caching strategies that reduce redundant network requests while maintaining data freshness.

Do I need a port and adapter boundary to set up a caching layer?

Yes, a port and adapter boundary is required to set up this caching layer. The architecture explicitly wraps existing repository ports, API clients, or HTTP endpoints with Redis-backed cache stores to intercept reads and apply mutation-invalidation on writes.

Can I apply HTTP Cache-Control headers to external API clients?

Yes, you can apply HTTP Cache-Control headers to external API clients. The caching strategy selectively utilizes these headers on HTTP endpoints and external API clients to enable robust client-side caching and reduce repeated network traffic.

Why should I use a layered caching strategy instead of a single cache?

Use a layered caching strategy instead of a single cache to independently optimize read performance across infrastructure adapters, HTTP endpoints, and the frontend. This distributed approach preserves data correctness through mutation-invalidation while preventing broad cache wipes.