cache_fu 0.2.0.pre1 → 0.2.0.pre2
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/lib/acts_as_cached/cache_methods.rb +12 -9
- metadata +3 -3
@@ -3,13 +3,7 @@ module ActsAsCached
|
|
3
3
|
@@nil_sentinel = :_nil
|
4
4
|
|
5
5
|
def cache_config
|
6
|
-
|
7
|
-
if name == cache_name
|
8
|
-
config
|
9
|
-
else
|
10
|
-
# sti
|
11
|
-
ActsAsCached::Config.class_config[name] ||= config.dup
|
12
|
-
end
|
6
|
+
@cache_config ||= {}
|
13
7
|
end
|
14
8
|
|
15
9
|
def cache_options
|
@@ -183,7 +177,7 @@ module ActsAsCached
|
|
183
177
|
end
|
184
178
|
|
185
179
|
def cache_name
|
186
|
-
@cache_name ||= respond_to?(:
|
180
|
+
@cache_name ||= respond_to?(:model_name) ? model_name.cache_key : name
|
187
181
|
end
|
188
182
|
|
189
183
|
def cache_keys(*cache_ids)
|
@@ -223,7 +217,16 @@ module ActsAsCached
|
|
223
217
|
end
|
224
218
|
|
225
219
|
def cache_id(key = nil)
|
226
|
-
|
220
|
+
cid = case
|
221
|
+
when new_record?
|
222
|
+
"new"
|
223
|
+
when timestamp = self[:updated_at]
|
224
|
+
timestamp = timestamp.utc.to_s(:number)
|
225
|
+
"#{id}-#{timestamp}"
|
226
|
+
else
|
227
|
+
id.to_s
|
228
|
+
end
|
229
|
+
key.nil? ? cid : "#{cid}/#{key}"
|
227
230
|
end
|
228
231
|
|
229
232
|
def caches(method, options = {})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cache_fu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: -
|
4
|
+
hash: -1876988175
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 0.2.0.
|
10
|
+
- pre2
|
11
|
+
version: 0.2.0.pre2
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Surendra Singhi
|