Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rails drop in for Varnish support.
Ruby

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
rails
test
.document
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION
init.rb
lacquer.gemspec

README.rdoc

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
  }
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) }

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 © 2010 Russ Smith. See LICENSE for details.

Something went wrong with that request. Please try again.