Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honkster/cache-store-api
Ruby cache methods built on top of Rails and Sinatra caching.
https://github.com/honkster/cache-store-api
Last synced: 3 months ago
JSON representation
Ruby cache methods built on top of Rails and Sinatra caching.
- Host: GitHub
- URL: https://github.com/honkster/cache-store-api
- Owner: honkster
- License: mit
- Created: 2010-09-28T07:07:14.000Z (about 14 years ago)
- Default Branch: master
- Last Pushed: 2011-09-07T18:30:06.000Z (about 13 years ago)
- Last Synced: 2024-07-17T09:27:40.307Z (4 months ago)
- Language: Ruby
- Homepage:
- Size: 99.6 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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")