artirix_data_models 0.30.0 → 0.31.0

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: 9fcaa48c654a96f1062489441cafa40627bfde65
4
- data.tar.gz: f14c51eff09a4789e333662ba7f24c0c64e4a8f0
3
+ metadata.gz: e0da26214f0430c9250de8d6612d9f0f6b98ad49
4
+ data.tar.gz: 4dfcc8eaec6f4aaec45ef8a62fbb8c07efa52d7e
5
5
  SHA512:
6
- metadata.gz: 22466685aad6723fbae5f3ce71127abe20654b32d578a53dfb8f0de5eeab6802daea45bc8a1090be0f6bc5937a6ea11b240f1a7044d58e5c48d4e1fbb19c84c0
7
- data.tar.gz: e3c9ec83addf5d5407cf5f18e7aa1832cceae0c50f50d50cd0e5a6e229f6defa36d0d48c6c693011decacb821ad2a86a4a4fc911309cb733160c375bb59d5cdf
6
+ metadata.gz: 266689d66972416d55e64c828709b90f58a71b5daa22e0c99d1b7f1174b763280fa0ab30cecc9b0e047ab1b58ba0cf9af2e1a46e5ada169f712c33bfc124cbc4
7
+ data.tar.gz: 23a3285b7906014c27074f08f73936bfb9dc02e50d42482cdf41ea64d19a6546aafcfb2a81c646f98ecf8796ff6f6dfe4bbc1b7de422d7deea06b8b16bc12f24
data/README.md CHANGED
@@ -327,6 +327,11 @@ end
327
327
 
328
328
  ## Changes
329
329
 
330
+ ### 0.31.0
331
+
332
+ - `CacheAdaptor` has a `delete` method now, which calls `cache.delete cache_key`.
333
+ - Gateway tries to call `cache_adaptor.delete` if any exception is raised during a request (including parsing the response), before re-raising the exception.
334
+
330
335
  ### 0.30.0
331
336
 
332
337
  - expose as config in connection the `faraday_adapter`. If falsey it will default to `Faraday.default_adapter`.
@@ -41,6 +41,11 @@ class ArtirixDataModels::CachedActionAdaptor
41
41
  @enabled
42
42
  end
43
43
 
44
+ def delete
45
+ return true unless enabled?
46
+ cache_delete
47
+ end
48
+
44
49
  private
45
50
 
46
51
  def get_cached_result
@@ -114,4 +119,11 @@ class ArtirixDataModels::CachedActionAdaptor
114
119
  value
115
120
  end
116
121
 
122
+ def cache_delete
123
+ logger.debug "DELETE CACHE with key #{cache_key.inspect}"
124
+ return true unless cache
125
+
126
+ cache.delete cache_key, cache_options
127
+ end
128
+
117
129
  end
@@ -79,6 +79,14 @@ class ArtirixDataModels::DataGateway
79
79
  response_adaptor: response_adaptor,
80
80
  method: method,
81
81
  path: path
82
+ rescue => e
83
+ # if anything goes wrong => delete the cache just in case.
84
+
85
+ if cache_adaptor.present? && cache_adaptor.respond_to?(:delete)
86
+ cache_adaptor.delete
87
+ end
88
+
89
+ raise e
82
90
  end
83
91
 
84
92
  private
@@ -1,3 +1,3 @@
1
1
  module ArtirixDataModels
2
- VERSION = '0.30.0'
2
+ VERSION = '0.31.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artirix_data_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Turiño