From ruby-on-rails
Rails caching strategies including fragment caching, low-level caching with Rails.cache, cache keys, and conditional GET. Use when the user asks about caching performance or invalidation in Rails.
npx claudepluginhub bastos/ruby-plugin-marketplace --plugin ruby-on-railsThis skill uses the workspace's default tool permissions.
Use Rails caching to reduce response time and database load while keeping
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Use Rails caching to reduce response time and database load while keeping content fresh. This skill focuses on fragment caching, low-level caching, cache keys, and conditional GETs.
Wrap view fragments that can be reused:
<% @products.each do |product| %>
<% cache product do %>
<%= render product %>
<% end %>
<% end %>
Notes:
cache_key_with_version) help expire cached content when
records change.Use Rails.cache.fetch for expensive computations:
class Product < ApplicationRecord
def competing_price
Rails.cache.fetch("#{cache_key_with_version}/competing_price", expires_in: 12.hours) do
Competitor::API.find_price(id)
end
end
end
Guidance:
fetch to avoid separate read/write logic.expires_in for data that should age out.Objects should implement cache_key (Active Record provides it).
Keys can be arrays or hashes:
Rails.cache.read(site: "mysite", owners: [owner_1, owner_2])
Notes:
Leverage ETags and Last-Modified to return 304 Not Modified:
class ProductsController < ApplicationController
def show
@product = Product.find(params[:id])
if stale?(last_modified: @product.updated_at.utc, etag: @product.cache_key_with_version)
# normal response rendering
end
end
end