caching

Cache frequently requested results with TTL-based expiry and write-through invalidation.

13|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/yanko-belov/code-craft --skill caching-yanko-belov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching
Source: https://github.com/yanko-belov/code-craft/tree/main/skills/caching
Command: npx skills add https://github.com/yanko-belov/code-craft --skill caching-yanko-belov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Caching reduces repeated data fetches and database load by storing frequently requested results close to the caller, but requires thoughtful invalidation to avoid stale data.

Core Features & Use Cases

  • TTL-based expiry with automatic eviction to keep data reasonably fresh.
  • Explicit invalidation on writes to clear affected cache entries.
  • Patterns supported: TTL, write-through, cache-aside, and event-based invalidation for distributed systems.
  • Use Case: Read-heavy microservices that query the same aggregate data frequently.

Quick Start

Use caching to store user profiles after the first fetch and invalidate on user updates.

Frequently Asked Questions about caching

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

FAQPage Schema
How do I implement caching to reduce repeated data fetches in read-heavy microservices?

To implement caching in read-heavy microservices, use the cache-aside pattern to store frequently requested aggregate data close to the caller. This reduces database load by serving subsequent reads directly from the cache instead of repeating data fetches.

What is the best way to handle cache invalidation and avoid stale data?

The best way to handle cache invalidation and avoid stale data is combining TTL-based expiry for automatic eviction with explicit invalidation on writes. This approach clears affected cache entries during updates to maintain data freshness.

What caching patterns are available for distributed systems requiring event-based coherence?

Caching patterns for distributed systems requiring event-based coherence include TTL, write-through, cache-aside, and event-based invalidation. These strategies ensure predictable eviction and maintain cache coherence across multiple services.

Does this caching approach work for microservices that repeatedly query the same user profiles?

Yes, this caching approach works for microservices that repeatedly query the same user profiles. You can cache user profiles after the first fetch and explicitly invalidate the cached entries when user updates occur to ensure data freshness.

When should I not use TTL-based expiry for managing data freshness?

You should not rely solely on TTL-based expiry when immediate data consistency is required after writes. In these cases, use write-through invalidation or event-based coherence to actively clear affected cache entries instead of waiting for automatic eviction.