cache_utils 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cache_utils/model.rb +5 -1
- data/lib/cache_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a748668ea86e250e5cbe25c593f6131aacf06f75
|
4
|
+
data.tar.gz: 8bc54cc80bcd345f690c884d45930775baf639d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84e017bb9f2f2ffafc004baac55e8efdcb45cce03887a6682fa563c6cee34cbf12300aba02cd462a82c041e22d407e2dcfa2b2f3b1f36c08a12f38bd57e1b34d
|
7
|
+
data.tar.gz: 7eb218e0a42b34c56ec8601f6f5160ac846380150a100a33dc65be2fe708ac5e4a0944d3ebf97cb4965bf5599e31af97765ec5189cb0a27694be658897f5f600
|
data/lib/cache_utils/model.rb
CHANGED
@@ -4,7 +4,7 @@ module CacheUtils
|
|
4
4
|
|
5
5
|
module ClassMethods
|
6
6
|
def cache_key
|
7
|
-
to_s.pluralize
|
7
|
+
to_s.underscore.pluralize + '/index'
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
@@ -12,6 +12,10 @@ module CacheUtils
|
|
12
12
|
after_save :purge_cache
|
13
13
|
end
|
14
14
|
|
15
|
+
def custom_cache_key
|
16
|
+
self.class.to_s.underscore.pluralize + "/#{id}"
|
17
|
+
end
|
18
|
+
|
15
19
|
def purge_cache
|
16
20
|
Rails.cache.data.del(*(Rails.cache.data.keys(cache_key) + [self.class.cache_key]))
|
17
21
|
end
|
data/lib/cache_utils/version.rb
CHANGED