graphql-result_cache 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cca173c02ac7fcc48f7167ecfe2aaf9abfe861bc783da968473cd2d8705b23c3
4
- data.tar.gz: bfaeb36f3897300d3eb9b7b8d4bd8a5ed0c9396d06b81b0861e2d7290c272a30
3
+ metadata.gz: 6cae5e83e05f6aae4a8ac2c26a6d2077d25c7fa32176234f347b0e8273a6ee3e
4
+ data.tar.gz: 77fb9355094bb37c82991a935e2f91058b7e2b7f93510c8037665a1f88df13d3
5
5
  SHA512:
6
- metadata.gz: 7817142f3cf86c97e42fe3fa11e1d84642bb81b158b36df1f6d3a039ee9284f26d7b838818d720a5ee44683a2d3845211f7206b8d83f8d68662b6e73c3656b44
7
- data.tar.gz: 1247cc3baa0720659ae71b796c0500b3c166428ac0e62792e63acd054d05565f8d40a2971d42fe2e0b225a3f7ef0409e4d039aabc0ae4dceb355e24786a9de57
6
+ metadata.gz: caf21c2c2c7f4bdf29f714376f4867390f3b8f8ff894692d918574a300820abead72a13c8e321c67097381d5ffabc0b6c6de8bbfe95bb7d136e4d0fbd43e0c49
7
+ data.tar.gz: 35677cba82ea49aaf9bd94aa059249f80d6ef9caf35476a6edc418012d7467f1f53d52b0bd48ca3a73d428d4be362473f8cf05cec98d660f1f4b3a2d47fc5ffd
@@ -11,6 +11,7 @@ module GraphQL
11
11
  attr_accessor :expires_in
12
12
  attr_accessor :namespace
13
13
  attr_accessor :cache
14
+ attr_accessor :cache_write_options
14
15
  attr_accessor :logger
15
16
 
16
17
  # to expire the cache when client hash changes, should be a proc. eg:
@@ -39,7 +39,7 @@ module GraphQL
39
39
  def cache_or_amend_result result, config_of_query
40
40
  config_of_query.each do |config|
41
41
  if config[:result].nil?
42
- cache.write config[:key], result.dig('data', *config[:path]), expires_in: expires_in
42
+ cache.write config[:key], result.dig('data', *config[:path]), cache_write_options.merge(expires_in: expires_in)
43
43
  else
44
44
  # result already got from cache, need to amend to response
45
45
  result_hash = result.to_h
@@ -78,6 +78,10 @@ module GraphQL
78
78
  ::GraphQL::ResultCache.cache
79
79
  end
80
80
 
81
+ def cache_write_options
82
+ ::GraphQL::ResultCache.cache_write_options || {}
83
+ end
84
+
81
85
  def logger
82
86
  ::GraphQL::ResultCache.logger
83
87
  end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module ResultCache
3
- VERSION = '0.1.4'
3
+ VERSION = '0.1.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-result_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ying Fu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-12 00:00:00.000000000 Z
11
+ date: 2019-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler