Sha256: 68c716fa6a4804103a598d1cca612ed83e531ac6c46ca43ca522e49478f4c84e
Contents?: true
Size: 1.76 KB
Versions: 1
Compression:
Stored size: 1.76 KB
Contents
= lacquer Rails drop in for Varnish support. == Install Basic installation rails generate lacquer install config/initializers/lacquer.rb Lacquer.configure do |config| # Globally enable/disable cache config.enable_cache = true # Unless overridden in a controller or action, the default will be used config.default_ttl = 1.week # Can be :none, :delayed_job, :resque config.job_backend = :none # Array of Varnish servers to manage config.varnish_servers << { :host => '0.0.0.0', :port => 6082 } # Number of retries config.retries = 5 # config handler (optional, if you use Hoptoad or another error tracking service) config.command_error_handler = lambda {|s| HoptoadNotifier.notify(s) } end app/controllers/application_controller.rb class ApplicationController < ActionController::Base include Lacquer::CacheUtils end == Usage To set a custom ttl for a controller: before_filter { |controller| controller.set_cache_ttl(15.minutes) } Clearing the cache: class Posts < ApplicationController after_filter :clear_cache, :only => [ :create, :update, :destroy ] private def clear_cache clear_cache_for( root_path, posts_path, post_path(@post)) end end == Note on Patches/Pull Requests * Fork the project. * Make your feature addition or bug fix. * Add tests for it. This is important so I don't break it in a future version unintentionally. * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) * Send me a pull request. Bonus points for topic branches. == Copyright Copyright (c) 2010 Russ Smith. See LICENSE for details.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
posterous-lacquer-0.2.3 | README.rdoc |