readme.md in method_cacheable-0.0.3 vs readme.md in method_cacheable-0.0.4
- old
+ new
@@ -3,10 +3,13 @@
Cache method calls and speed up your Ruby on Rails application with MethodCacheable.
Method Cacheable
============
+In your Model include `MethodCacheable`
+
+app/models/user.rb
``` ruby
class User < ActiveRecord::Base
include MethodCacheable
has_many :pictures
@@ -14,11 +17,15 @@
def expensive_method(val)
sleep 120
return val
end
end
+```
+Then use the `#cache` method to fetch results from cache when available
+
+```
user = User.last
# Call User#expensive_method normally
user.expensive_method(22)
# => 22
@@ -43,10 +50,19 @@
=======
in your Gemfile
gem 'method_cacheable'
+In an initializer tell MethodCacheable to use the Rails.cache backend. You can use any object here that responds to `#write`, `#read`, and `#fetch`
+
+initializers/method_cacheable.rb
+```ruby
+ MethodCacheable.config do |config|
+ config.store = Rails.cache
+ end
+```
+
then in your models
include MethodCacheable
@@ -103,6 +119,10 @@
Fork away. If you want to chat about a feature idea, or a question you can find me on the twitters [@schneems](http://twitter.com/schneems). Put any major changes into feature branches. Make sure all tests stay green, and make sure your changes are covered.
licensed under MIT License
Copyright (c) 2011 Schneems. See LICENSE.txt for
-further details.
\ No newline at end of file
+further details.
+
+
+
+