My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
ESI_and_Rails  
Updated Jan 5, 2008 by adamb...@gmail.com

Setting up a Rails Project

gem install mongrel_esi

or

wget http://mongrel-esi.googlecode.com/files/mongrel-esi-0.4.0.gem

or

curl wget http://mongrel-esi.googlecode.com/files/mongrel-esi-0.4.0.gem > mongrel-esi-0.4.0.gem

rails new_project

cd new_project

create config.rb

ESI::Config.define(listeners) do|config|

  # define the caching rules globally for all routes, defaults to ruby
  config.cache do|c|
    #c.memcached do|mc|
    #  mc.servers = ['localhost:11211']
    #  mc.debug = false
    #  mc.namespace = 'mesi'
    #  mc.readonly = false
    #end
    c.ttl = 600
  end

  # define rules for when to enable esi processing globally for all routes
  config.esi do|c|
    c.allowed_content_types = ['text/plain', 'text/html']
    #c.enable_for_surrogate_only = true # default is false
  end

  # define request path routing rules
  config.routes do|s|
    #s.match( /content/ ) do|r|
    #  r.servers = ['127.0.0.1:4000']
    #end
    s.default do|r|
      r.servers = ['127.0.0.1:3000']
    end
  end

end

To start up mongrel-esi with your new configuration run:

mongrel_esi -S config.rb

Sign in to add a comment
Powered by Google Project Hosting