📝
article
rubyflow.com
·
October 21, 2026
Seven layers of cache in a Rails app, from the browser to Russian doll
This post walks through the seven places a request can be answered before it reaches Postgres: browser cache (expires_in, fresh_when), Varnish, Nginx proxy cache, action caching, Russian doll fragments in ERB and jbuilder, Rails.cache on Memcached or Solid Cache, and an object cache on Redis. Each layer comes with its config, what it actually saves, and how it breaks (cookies vs Varnish, CSRF in cached actions, sharing Redis with Sidekiq). Ends with a suggested build order: headers first, edg...
Read on rubyflow.com →