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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46351acd75da3e9389df085d1ac1f2c0650b8170
4
- data.tar.gz: dbc025033b44bafb353808a79677a0cd26f1d168
3
+ metadata.gz: 580cad486d7e57555b86e4435a284adcd88e0aa2
4
+ data.tar.gz: 95cf3729a52a7e2116383dac48a8064f267f0d11
5
5
  SHA512:
6
- metadata.gz: 9e0688236b185df19b6b5aeec4ea71c96b3a13a00781db5e53d40961705e0ca19eb9d6451418641dfe970c2b72d9035ba9d1bddb4aa9e02c395c10158dfe4d7b
7
- data.tar.gz: 6cf4baac1f99bc41780b602a1ea7f8c0ec52217d1c6b7dec026e79c9f8bd48a0d1687b5bffc9c7742b3414fd880f4e4c24d46657f5bf60fe083762df2549aac7
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(pattern)
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
- suf = pattern.present? ? "#{pattern}*" : ''
155
- "*#{prefix}*#{suf}"
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
- ArtirixDataModels.cache.delete_matched final_pattern(pattern)
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
@@ -1,3 +1,3 @@
1
1
  module ArtirixDataModels
2
- VERSION = '0.14.1'
2
+ VERSION = '0.14.2'
3
3
  end
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.1
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-02 00:00:00.000000000 Z
11
+ date: 2016-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport