Sha256: 9b06c3239ff4f12b9757686ecb79feff7d1af803a44737a8a68ead98abe3ee9d

Contents?: true

Size: 916 Bytes

Versions: 2

Compression:

Stored size: 916 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:

  sudo gem install ninjudd-memcache -s http://gems.github.com
  sudo gem install ninjudd-cache_version -s http://gems.github.com
  sudo gem install ninjudd-method_cache -s http://gems.github.com

== License:

Copyright (c) 2009 Justin Balthrop, Geni.com; Published under The MIT License, see LICENSE

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
ninjudd-method_cache-0.6.2 README.rdoc
method_cache-0.6.3 README.rdoc