Ruby cache methods built on top of Rails and Sinatra caching.
Ruby Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.runrc
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
cache-store-api.gemspec

README.md

CacheStoreApi

lazy_cache

Lazily cache the contents of the block. It takes the cache key and time to expiration as arguments.

CacheStoreApi.lazy_cache("cache-key", 1.week) do
  @my_expensive_models = Model.all(:conditions => "some-expensive-query")
  render_to_string(:template => "my/template/path/index.html")
end.tap do |html|
  render :text => html
end

expire

Expires the given cache key.

CacheStoreApi.expire("cache-key")

cache

Access to the raw cache object.

CacheStoreApi.cache.instance_variable_get("@pool")