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 #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (4 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles