RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

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, edge last.

If the form strips Markdown, use This post for the link.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in