graphql-fragment_cache 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/graphql/fragment_cache/cacher.rb +6 -2
- data/lib/graphql/fragment_cache/fragment.rb +5 -1
- data/lib/graphql/fragment_cache/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac4b97c7253e848ab4ff72052df5b1eb368aa5bd1537b561423cc1ae80419dbc
|
4
|
+
data.tar.gz: 2c6179d4c6fc56e1047f11f886ac05a4a9a5d701fab9222669635e8d82794a31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c70fa81b9330e80b4260f8d15beafc3d92cd9ea6b73257234ba518b13e96232a6734793d10a71363531166343aed413605a5d7deb7a11d5bd5c8fc9101ba0bbc
|
7
|
+
data.tar.gz: fbda61fba31e3d14a01d035cc087d212642066aa9548ef2e01d4b2ad1c22c1b651cc57548bc66d3127162979815413943c621917d1d392ccd52e028a9af7fa03
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## 1.5.1 (2021-03-10)
|
6
|
+
|
7
|
+
- [PR#53](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/53) Use thread-safe query result for final_value ([@bbugh][])
|
8
|
+
- [PR#51](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/51) Do not cache fragments without final value ([@DmitryTsepelev][])
|
9
|
+
|
5
10
|
## 1.5.0 (2021-02-20)
|
6
11
|
|
7
12
|
- [PR#50](https://github.com/DmitryTsepelev/graphql-ruby-fragment_cache/pull/50) Add object_cache_key to CacheKeyBuilder ([@bbugh][])
|
@@ -20,17 +20,21 @@ module GraphQL
|
|
20
20
|
private
|
21
21
|
|
22
22
|
def batched_persist(query)
|
23
|
-
query.
|
23
|
+
select_valid_fragments(query).group_by(&:options).each do |options, group|
|
24
24
|
hash = group.map { |fragment| [fragment.cache_key, fragment.value] }.to_h
|
25
25
|
FragmentCache.cache_store.write_multi(hash, **options)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
def persist(query)
|
30
|
-
query.
|
30
|
+
select_valid_fragments(query).each do |fragment|
|
31
31
|
FragmentCache.cache_store.write(fragment.cache_key, fragment.value, **fragment.options)
|
32
32
|
end
|
33
33
|
end
|
34
|
+
|
35
|
+
def select_valid_fragments(query)
|
36
|
+
query.context.fragments.select(&:with_final_value?)
|
37
|
+
end
|
34
38
|
end
|
35
39
|
end
|
36
40
|
end
|
@@ -28,6 +28,10 @@ module GraphQL
|
|
28
28
|
@cache_key ||= CacheKeyBuilder.call(path: path, query: context.query, **options)
|
29
29
|
end
|
30
30
|
|
31
|
+
def with_final_value?
|
32
|
+
!final_value.nil?
|
33
|
+
end
|
34
|
+
|
31
35
|
def value
|
32
36
|
final_value.dig(*path)
|
33
37
|
end
|
@@ -53,7 +57,7 @@ module GraphQL
|
|
53
57
|
end
|
54
58
|
|
55
59
|
def final_value
|
56
|
-
@final_value ||=
|
60
|
+
@final_value ||= context.query.result["data"]
|
57
61
|
end
|
58
62
|
end
|
59
63
|
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.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DmitryTsepelev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: graphql
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.4.9
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: graphql-batch
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
153
167
|
description: Fragment cache for graphql-ruby
|
154
168
|
email:
|
155
169
|
- dmitry.a.tsepelev@gmail.com
|