public
Description: Caches.rb is a simplistic method cache for Ruby
Clone URL: git://github.com/yrashk/caches.rb.git
name age message
file README Sun Sep 24 07:53:30 -0700 2006 Initial sources [yrashk]
file Rakefile Sun Apr 01 05:39:09 -0700 2007 More refactoring; MemCached storage introduced [yrashk]
file init.rb Sun Apr 08 06:37:16 -0700 2007 ActiveRecord workaround (only cached object pro... [yrashk]
directory lib/ Mon May 26 12:48:12 -0700 2008 Minor library load improvement [yrashk]
directory spec/ Thu Apr 19 02:18:10 -0700 2007 starting new spec [yrashk]
README
Caches.rb
=========

Caches.rb is a simplistic method cache for Ruby

Simply do `BaseClass.extend Caches' and you will be able to specify

caches :method_name
or
caches :method_name, :timeout => 2.minutes

Default timeout is 60 seconds.

What is important is that this solution caches calls with arguments. For example, if you will make a 
method_name(“Hello”) call you’ll get next method_name(“Hello”) cached, but method_name(“Bye”) will not be cached.

Also you will be able to invalidate cache explicitly with invalidate_method_name_cache and 
invalidate_all_method_name_caches calls.

Also you can invalidate caches with

invalidate_all_caches
or
invalidate_all_caches :except => :name
or
invalidate_all_caches :except => [:name, :name1]