simple_cacheable 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cacheable/version.rb +1 -1
- data/lib/cacheable.rb +3 -3
- metadata +2 -2
data/lib/cacheable/version.rb
CHANGED
data/lib/cacheable.rb
CHANGED
@@ -3,12 +3,12 @@ module Cacheable
|
|
3
3
|
base.class_eval do
|
4
4
|
class <<self
|
5
5
|
def model_cache(&block)
|
6
|
-
class_attribute :
|
6
|
+
class_attribute :cached_key, :cached_indices, :cached_methods
|
7
7
|
instance_exec &block
|
8
8
|
end
|
9
9
|
|
10
10
|
def with_key
|
11
|
-
self.
|
11
|
+
self.cached_key = true
|
12
12
|
|
13
13
|
class_eval <<-EOF
|
14
14
|
after_update :expire_key_cache
|
@@ -107,7 +107,7 @@ module Cacheable
|
|
107
107
|
end
|
108
108
|
|
109
109
|
def expire_model_cache
|
110
|
-
expire_key_cache if self.class.
|
110
|
+
expire_key_cache if self.class.cached_key
|
111
111
|
expire_attribute_cache if self.class.cached_indices.present?
|
112
112
|
expire_method_cache if self.class.cached_methods.present?
|
113
113
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: simple_cacheable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Richard Huang
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-10-
|
13
|
+
date: 2011-10-21 00:00:00 +08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|