Castache
Simple structured cache for ruby apps. Marshals objects to and from Redis quickly and painlessly.
Installation
Add this line to your application's Gemfile:
gem 'castache'
And then execute:
$ bundle
Or install it yourself as:
$ gem install castache
Usage
require 'castache'
Castache.redis = Redis.new # you can also pass it a redis:// URI string
# or hash of options to pass to Redis.new
object = Castache.fetch 'cache:key:1' do
{greeting: 'hello'} # some expensive operation goes here...
end
p object
Castache.set 'cache:key:2', {greeting: 'goodbye'}
object2 = Castache.get 'cache:key:2'
p object2
objects = Castache.mget ['cache:key:1','cache:key:2']
objects.each {|o| puts o[:greeting] }
Project Status
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request