graphql-fragment_cache 1.13.0 → 1.13.1

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
  SHA256:
3
- metadata.gz: af4f8899ace77b66aaabd9af9292de07a40d2384ef8db4a24394e75bdd4be78d
4
- data.tar.gz: 21b141a16d460b4d1b8b6cf1146e54898a87c45b4f670aa0ab6cbaac78dc48d3
3
+ metadata.gz: 9fe4856af12987ff49d92ed9551c46cb64634d48a0112c323436e953ec55990a
4
+ data.tar.gz: 0d69c3d4096474724b0ec6b409bb5ecdbbcda5b81f20e5ae035e1ae1c77f18ce
5
5
  SHA512:
6
- metadata.gz: 6af77b269f6712c5c39983a796c0f109d6098297de2ad2c2fd87b5f4b8c0e53f9b71d14a2d6e7d8eb0ec1f03c55f43f84f766cdc4663bcf0cd8c7c1148fef506
7
- data.tar.gz: e396f56ee9182d1147662fb484264ead58ea34efb867a9c6be9d1d018b94f9fb69089b981cb510c693ecd142a9c1fc20280d34c26bab71d9dc40af45d471944b
6
+ metadata.gz: 19f8d2bb9bc21a2bb0b79244e230fbede1b19e60beeadee2d0e7197b4a531d044bc5ca85120300c70a7ef2892e125a2a89b820e86a6aad14c5bd7e4fc572ebbf
7
+ data.tar.gz: 136ba3362d1c7fddad10dac6c27f4f3b95b624d0c14dedef3cd28afa63a61330a5d4f95b92a2aeed47b70dfbfb5bf7690cc0f9695561d56a1e34d0fd2ebfd691
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.13.1 (2022-10-12)
6
+
7
+ - [PR#84](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/84) Fix Renew Cache Read Multi Bug ([@KTSCode][])
8
+
5
9
  ## 1.13.0 (2022-09-12)
6
10
 
7
11
  - [PR#83](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/83) Update Lookahead usage to support graphql-2.0.14 ([@DmitryTsepelev][])
@@ -138,3 +142,4 @@
138
142
  [@mretzak]: https://github.com/mretzak
139
143
  [@daukadolt]: https://github.com/daukadolt
140
144
  [@frostmark]: https://github.com/frostmark
145
+ [@KTSCode]: https://github.com/KTSCode
@@ -19,15 +19,20 @@ module GraphQL
19
19
  fragments_to_cache_keys = fragments
20
20
  .map { |f| [f, f.cache_key] }.to_h
21
21
 
22
- cache_keys = fragments_to_cache_keys.values
23
-
24
- cache_keys_to_values = FragmentCache.cache_store.read_multi(*cache_keys)
25
-
26
- fetched_fragments_to_values = cache_keys_to_values
27
- .map { |key, val| [fragments_to_cache_keys.key(key), val] }
28
- .to_h
22
+ # Filter out all the cache_keys for fragments with renew_cache: true in their context
23
+ cache_keys = fragments_to_cache_keys
24
+ .reject { |k, _v| k.context[:renew_cache] == true }.values
25
+
26
+ # If there are cache_keys look up values with read_multi otherwise return an empty hash
27
+ cache_keys_to_values = if cache_keys.empty?
28
+ {}
29
+ else
30
+ FragmentCache.cache_store.read_multi(*cache_keys)
31
+ end
29
32
 
30
- fetched_fragments_to_values
33
+ # Fragmenst without values or with renew_cache: true in their context will have nil values like the read method
34
+ fragments_to_cache_keys
35
+ .map { |fragment, cache_key| [fragment, cache_keys_to_values[cache_key]] }.to_h
31
36
  end
32
37
  end
33
38
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module GraphQL
4
4
  module FragmentCache
5
- VERSION = "1.13.0"
5
+ VERSION = "1.13.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-fragment_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.13.0
4
+ version: 1.13.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - DmitryTsepelev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-12 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: graphql