caching-patterns

Manages caching for Ruby on Rails applications with Solid Cache.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/hidalgofdz/prestamista --skill caching-patterns-hidalgofdz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: caching-patterns
Source: https://github.com/hidalgofdz/prestamista/tree/main/.claude/skills/caching-patterns
Command: npx skills add https://github.com/hidalgofdz/prestamista --skill caching-patterns-hidalgofdz

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

This Skill helps developers implement effective caching techniques to improve application responsiveness and reduce server load.

Core Features & Use Cases

  • HTTP caching with ETags and fresh_when for efficient responses: Minimize unnecessary data transfer during client requests.
  • Russian doll caching with nested cache blocks and touch: true associations: Automatically invalidate related cache fragments when underlying data changes.
  • Collection caching using cache_collection: Batch cache multiple records efficiently for list views.
  • Low-level caching with Rails.cache.fetch: Store expensive computations or data aggregations to enhance scalability.

Quick Start

Use the caching-patterns skill to set up HTTP cache headers for your resource endpoints.

Frequently Asked Questions about caching-patterns

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

FAQPage Schema
How do I implement Russian doll caching in Rails to handle nested fragment invalidation?

Implement Russian doll caching by nesting fragment cache blocks and using touch: true on associations. This automatically invalidates parent cache fragments when underlying data changes, ensuring efficient cache management for nested views.

What is the best way to cache expensive database aggregations using low-level Rails caching?

The best way to cache expensive database aggregations is using low-level caching with Rails.cache.fetch. This stores expensive computations or data aggregations, reducing server load and enhancing application scalability.

How do I set HTTP caching headers with ETags to minimize unnecessary data transfer?

Set HTTP caching headers using ETags and fresh_when for efficient responses. This minimizes unnecessary data transfer during client requests by allowing browsers to verify resource freshness without re-downloading unchanged payloads.

Can I batch cache multiple records efficiently for Rails list views?

Yes, you can batch cache multiple records efficiently for list views using collection caching. The cache_collection mechanism caches multiple records together, significantly reducing rendering time for list-based interfaces.

Does this caching approach work with Solid Cache for Ruby on Rails applications?

Yes, these caching patterns are fully compatible with Ruby on Rails and Solid Cache. They provide comprehensive mechanisms for cache invalidation, key scaling, and performance optimization suitable for backend developers.