Skip to content
Powerful memcache-based memoization library for Ruby
Ruby
Find file
Pull request Compare This branch is 22 commits behind ninjudd:master.
Latest commit 8e318cd Sep 20, 2011 Amos Elliston Version bump to 0.7.1
Failed to load latest commit information.
lib fixed local caching nil values Sep 20, 2011
test
.gitignore
LICENSE
README.rdoc
Rakefile
VERSION.yml Version bump to 0.7.1 Sep 20, 2011
method_cache.gemspec

README.rdoc

MethodCache

MethodCache lets you easily cache the results of any instance method or class method in Ruby.

Usage:

class Foo
  extend MethodCache

  cache_method :bar
  def bar
    # do expensive calculation
  end

  cache_class_method :baz, :clone => true, :expiry => 1.day
  def self.baz
    # do some expensive calculation that will be invalid tomorrow
  end
end

foo = Foo.new
foo.bar # does calculation
foo.bar # cached

Foo.baz # does calculation
Foo.baz # cached

Foo.invalidate_cached_method(:baz)

Foo.baz # does calculation
Foo.baz # cached

Install:

gem install method_cache

License:

Copyright © 2010 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE

Something went wrong with that request. Please try again.