Sha256: 8781fc0d191793624b54b191293f013a613d8c6f8b494e057b872e908b3cc122

Contents?: true

Size: 748 Bytes

Versions: 4

Compression:

Stored size: 748 Bytes

Contents

= 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 (c) 2010 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
method_cache-1.1.0 README.rdoc
method_cache-1.0.0 README.rdoc
jashmenn-method_cache-0.7.1.0 README.rdoc
method_cache-0.6.4 README.rdoc