method_cacheable 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/method_cacheable.rb +10 -4
- data/method_cacheable.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/method_cacheable.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
122
|
+
MethodCacheable.store.read(key, options)
|
117
123
|
elsif cache_operation == :write
|
118
124
|
val = caller_object.send method.to_sym, *args
|
119
|
-
MethodCacheable
|
125
|
+
MethodCacheable.store.write(key, val, options)
|
120
126
|
end
|
121
127
|
end
|
122
128
|
|
data/method_cacheable.gemspec
CHANGED
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Schneems
|