0.01
No commit activity in last 3 years
No release in over 3 years
Simple memcache-based memoization library for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

>= 1.0.0
 Project Readme

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