I Use This!
Activity Not Available
Analyzed about 2 years ago. based on code collected about 2 years ago.

Project Summary

Easycache lets you easily cache arbitrary data in your Ruby on Rails applications. The plugin makes use of Rails' built-in fragment caching mechanism to store and retrieve any serializable data. This is especially useful when you want to store data from slow/external sources like LDAP, Web Services, or REXML functions, for which Rails does not currently offer an integrated caching mechanism.

INSTALLATIONFrom the command line, cd into your Rails application's root directory and run:

ruby script/plugin install git://github.com/zuk/rails-easycache.git

EXAMPLESOnce you've installed the plugin, you should be able to do something like this anywhere in your application (in controllers, helpers, etc.):

foo = ['alpha', 'beta', 'delta', 'gamma']

# store foo in the cache under the keyname 'greek'
Easycache.write('greek', foo)

# retrieve the data stored under keyname 'greek'
foo = Easycache.read('greek')

# delete the data stored under keyname 'greek'
Easycache.delete('greek')In practice, you will probably want to use caching transparently, so that data is pulled from the cache if available, or from the original source otherwise. For example, say you have a function ldap_query() that does a slow LDAP query to retrieve some data. Just wrap this function call inside an Easycache.cache block, like this:

my_data = Easycache.cache('ldap_data') do
endThe first time the block runs, it will execute ldap_query(), store its return value in the cache under the key 'ldap_data', and return it for assignment into your my_data variable. The next time it's run, the return value will come from the cache, so the block won't need to be executed.

TIME-BASED EXPIRYThe write() and cache() methods both take an optional options hash. Currently the only supported option is :expiry, which will force the cached value to expire after the given number of seconds. For example:

Easycache.write('greek', ['alpha', 'beta'], :expiry => 60)or

greek = Easycache.cache('greek', :expiry => 60) do
['alpha', 'beta']
endThe above will expire the 'greek' value after 60 seconds. In Rails applications you can use active_support's time extensions to specify the expiry period. For example:

Easycache.write('greek', ['alpha', 'beta'], :expiry => 24.hours)


cache plugin rails ruby

In a Nutshell, easycache...

MIT License


Private Use

Commercial Use




Hold Liable


Include Copyright

Include License

These details are provided for information only. No information here is legal advice and should not be used as such.

All Licenses

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    compare projects before you chose one to use
  • ...
    use of OSS increased in 65% of companies in 2016
  • ...
    by exploring contributors within projects, you can view details on every commit they have made to that project

30 Day Summary

Apr 8 2016 — May 8 2016

12 Month Summary

May 8 2015 — May 8 2016


Be the first to rate this project
Click to add your rating
Review this Project!