artirix_data_models 0.14.1 → 0.14.2
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.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/lib/artirix_data_models/cache_service.rb +18 -7
- data/lib/artirix_data_models/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 580cad486d7e57555b86e4435a284adcd88e0aa2
|
4
|
+
data.tar.gz: 95cf3729a52a7e2116383dac48a8064f267f0d11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fa9d6d2f715dbcb3864b3c52b91dedce5fc6cf3de96b609172981d35e1e7283030027c938e77ec570b83c43efd2aa0674a72f87962214217efe723bcebacf01
|
7
|
+
data.tar.gz: a1b16317e95cedb8a09d09902e4c6e16966675fc22202204bbc52e2d8a68d6b1b7a8b85107f96b25af113e7e522ed9d10e637d477df89ac998e6e73cd874ae2f
|
data/README.md
CHANGED
@@ -268,6 +268,9 @@ end
|
|
268
268
|
|
269
269
|
## Changes
|
270
270
|
|
271
|
+
### 0.14.2
|
272
|
+
- Cache service: expire_cache now can receive options `add_wildcard` and `add_prefix` (both `true` by default), that will control the modifications on the given pattern
|
273
|
+
|
271
274
|
### 0.14.1
|
272
275
|
- Exceptions now with `data_hash` and ability to be raised with message, options, or both.
|
273
276
|
- Cache Adaptors now store the data hash of the NotFound exception, and a new one is built and raised when reading a cached NotFound.
|
@@ -18,6 +18,10 @@ module ArtirixDataModels::CacheService
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
def self.expire_cache(*args, &block)
|
22
|
+
Expirer.expire_cache *args, &block
|
23
|
+
end
|
24
|
+
|
21
25
|
def self.method_missing(m, *args, &block)
|
22
26
|
method = m.to_s
|
23
27
|
|
@@ -139,8 +143,10 @@ module ArtirixDataModels::CacheService
|
|
139
143
|
method_name.start_with? 'expire_'
|
140
144
|
end
|
141
145
|
|
142
|
-
def self.expire_cache(pattern = nil)
|
143
|
-
CacheStoreHelper.delete_matched
|
146
|
+
def self.expire_cache(pattern = nil, add_wildcard: true, add_prefix: true)
|
147
|
+
CacheStoreHelper.delete_matched pattern,
|
148
|
+
add_wildcard: add_wildcard,
|
149
|
+
add_prefix: add_prefix
|
144
150
|
end
|
145
151
|
end
|
146
152
|
|
@@ -150,14 +156,19 @@ module ArtirixDataModels::CacheService
|
|
150
156
|
"#{prefix}__#{key_value}"
|
151
157
|
end
|
152
158
|
|
153
|
-
def self.final_pattern(pattern)
|
154
|
-
|
155
|
-
"
|
159
|
+
def self.final_pattern(pattern, add_wildcard: true, add_prefix: true)
|
160
|
+
p = pattern
|
161
|
+
p = p.present? ? "#{p}*" : '' if add_wildcard
|
162
|
+
p = "*#{prefix}*#{p}" if add_prefix
|
163
|
+
p
|
156
164
|
end
|
157
165
|
|
158
|
-
def self.delete_matched(pattern = nil)
|
166
|
+
def self.delete_matched(pattern = nil, add_wildcard: true, add_prefix: true)
|
159
167
|
return false unless ArtirixDataModels.cache.present?
|
160
|
-
|
168
|
+
|
169
|
+
p = final_pattern(pattern, add_wildcard: add_wildcard, add_prefix: add_prefix)
|
170
|
+
|
171
|
+
ArtirixDataModels.cache.delete_matched p
|
161
172
|
end
|
162
173
|
|
163
174
|
def self.prefix
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artirix_data_models
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Turiño
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|