Cached pages with updated partials.
Serve completely cached pages, but keep e.g. "Welcome <%= current_user %>" updated.
Does not influence not-cached actions.
Up and running in 23 seconds or money back!
gem install easy_esi
class UsersController < ApplicationController
caches_action :show
enable_esi
end
Has no effect for non-esi controllers! <%= render 'profile' %> IS NOW <%= esi_render 'profile' %>
<%= render 'profile', :local_variable => :foo %>
IS NOW
<%= esi_render :partial => 'profile', :locals => {:local_variable => :foo} %>
esi_render
inserts an esi-include (<esi:include .... />
).
an after_filter
or easy-esi-rails-cache-hack replaces these by rendering the partial.
==> if you want to share view caches between controllers,
call enable_esi in all of them (or in ApplicationController).
Normally ESI means having an extra server that parses <esi>
tags and then calls your app to render these partials.
Which adds a whole lot of new problems(passing arguments, login, expiration, security...).
On top of that it will slow down your application unless you do everything so perfect that it gets
faster then a action-cached request (which is really hard...).
With 'hard' Esi, each <esi>
tag causes a new, (yet small) request which needs to load all data (instance-variables) anew.
With easy-esi, each <esi>
tag causes a partial to be rendered, inside the current context, re-using instance-variables.
Compared to normal ESI this means:
Michael Grosser
michael@grosser.it
License: MIT