method_cacheable 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
@@ -36,8 +36,14 @@ require 'active_support/concern'
36
36
  #
37
37
  # @see MethodCacheable#cache More info on cache options
38
38
  module MethodCacheable
39
+ mattr_accessor :store
39
40
  extend ActiveSupport::Concern
40
- STORE = nil || Rails.cache
41
+
42
+
43
+ def self.config
44
+ yield self
45
+ end
46
+
41
47
 
42
48
 
43
49
  # @overload cache
@@ -109,14 +115,14 @@ module MethodCacheable
109
115
  # @see http://api.rubyonrails.org/classes/ActionController/Caching.html#method-i-cache Rails.cache documentation
110
116
  def call_cache_operation(options = {})
111
117
  if cache_operation == :fetch
112
- MethodCacheable::STORE.fetch(key, options) do
118
+ MethodCacheable.store.fetch(key, options) do
113
119
  caller_object.send method.to_sym, *args
114
120
  end
115
121
  elsif cache_operation == :read
116
- MethodCacheable::STORE.read(key, options)
122
+ MethodCacheable.store.read(key, options)
117
123
  elsif cache_operation == :write
118
124
  val = caller_object.send method.to_sym, *args
119
- MethodCacheable::STORE.write(key, val, options)
125
+ MethodCacheable.store.write(key, val, options)
120
126
  end
121
127
  end
122
128
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "method_cacheable"
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Schneems"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: method_cacheable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Schneems