Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Reduce cache requests by preheating via multi_get
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
Gemfile
Gemfile.lock
Rakefile
Readme.md
VERSION
init.rb
preheatable_cache.gemspec

Readme.md

Reduce cache requests by preheating via multi_get.

Makes Rails MemCacheStore preheatable via read_multi, for keys that will later be used.
Clears the preheated cache after each request.

  • not threadsave
  • not altered when writing/incrementing/... underlying cache store

Install

gem install preheatable_cache

OR script/plugin install http://github.com/grosser/preheatable_cache

Usage

# controller - multi_get to fetch all keys at once
Rails.cache.preheat @products.map{|p| "views/product_#{p.id}" }

# view - no requests to the cache server
<% cache "product_#{product.id}" do %>
  ...
<% end %>

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...

Something went wrong with that request. Please try again.