Code Explainers
Code explainers tagged #cache-keys
ruby
class DashboardMetrics CACHE_TTL = 15.minutes def initialize(account)
Caching dashboard metrics in Rails
caching
service-object
query-optimization
Intermediate
5 steps
ruby
module ProductsHelper def cached_product_row(product) cache [product, current_user.role] do render partial: "products/row", locals: { product: product }
Russian doll caching that busts itself in Rails
fragment-caching
cache-invalidation
associations
Intermediate
4 steps
ruby
class ProductCatalog def featured_products Rails.cache.fetch("catalog/featured_products", expires_in: 12.hours) do Product.where(featured: true)
Caching patterns with Rails.cache.fetch
caching
cache-keys
expiry
Intermediate
5 steps