Full page caching in Rails part 2 - memcached and middleware

In this follow up to a previous post, I'll show how to implement full page caching in a Rails app using memcached instead of Redis, and a middleware instead of Nginx to remove some dependencies and simplify the...In a previous post, I showed how to implement full page caching in Rails with Nginx and Redis. I have in the meantime changed my approach for DynaBlogger and I am now using a memcached cluster for the cache instead of Redis, and a Rack middleware to serve cached pages instead of Nginx. Nginx may be a little faster since it allows serving content directly from cache, bypassing Rails entirely, but there is a big advantage with the new approach: Rails and Nginx "speak" different algorithms when hashing distributed cache keys in a Redis or memcached cluster (as opposed to a single Redis/memcached instance), making it difficult to write cache entries with Rails and read them with Nginx. The Nginx approach still works just fine with a standalone Redis/memcached instance but it's not as scalable.
Full page caching in Rails part 2 - memcached and middleware #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/full-page-caching-in-rails-part-2-memcached-and-middleware

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles