graphql-cache 0.2.1 → 0.2.2

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: e2adeaaafa2b7714c4300a996c5ae17581269dec775277ef4f8b9ddcd90be16b
4
- data.tar.gz: aebe2b614ab273b0e49fd7d2e5b997036196e69abd4a0db85a17db7715a084bc
3
+ metadata.gz: 866eda70401ee7db7847f5b87cf8d0e2a9f26e5d21428c4338ee40ea143e8339
4
+ data.tar.gz: ebf01aa744da393e9beb14c0dd6f9da20d34752c515b72b2aba08ae295390a4f
5
5
  SHA512:
6
- metadata.gz: 5f57bcda1e5ae7db5cacacfde797f353b86abf1feaaf7b87a47315a0b945b32969d415ac9ab39eef837c3011f46921d7f3c48534d56741964da5ba599c244086
7
- data.tar.gz: 9f9d0afb64baba52c851c1cfaab7142d9419abba765137187ac3853dbf48962214d093a83c73487fa225d99a849ddc1d12ca2612bb99ef4bcbbc67459cd5f5f8
6
+ metadata.gz: 02a82cb8c0544cfe51fa6fc6e397b402008b851fa3ef31ab28bdfd7effec996ce350052ceb4dcf1e46f25dbba97988e1e39c3f9327788b7514cdf19dadc88a5a
7
+ data.tar.gz: a7dfbad849adb64e6c401634d32902ec3c78443032737c31961fa97508fc285753e264d0a1c4b856dea53c7d8d6cd32f56e8e70cc62be1a81d9e3dc13e490109
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-cache (0.2.1)
5
- graphql (~> 1.8.0.pre10)
4
+ graphql-cache (0.2.2)
5
+ gemer (~> 0.1)
6
+ graphql (~> 1.8.0)
6
7
 
7
8
  GEM
8
9
  remote: https://rubygems.org/
@@ -12,6 +13,7 @@ GEM
12
13
  coderay (1.1.2)
13
14
  diff-lcs (1.3)
14
15
  docile (1.3.0)
16
+ gemer (0.1.2)
15
17
  graphql (1.8.0)
16
18
  json (2.1.0)
17
19
  method_source (0.9.0)
@@ -51,4 +53,4 @@ DEPENDENCIES
51
53
  simplecov
52
54
 
53
55
  BUNDLED WITH
54
- 1.16.1
56
+ 1.16.2
@@ -28,5 +28,6 @@ Gem::Specification.new do |s|
28
28
  s.add_development_dependency 'rspec', '~> 3.0'
29
29
  s.add_development_dependency 'simplecov'
30
30
 
31
- s.add_dependency 'graphql', '~> 1.8.0.pre10'
31
+ s.add_dependency 'gemer', '~> 0.1'
32
+ s.add_dependency 'graphql', '~> 1.8.0'
32
33
  end
@@ -1,3 +1,5 @@
1
+ require 'gemer'
2
+
1
3
  require 'graphql/cache/version'
2
4
  require 'graphql/cache/middleware'
3
5
  require 'graphql/cache/field'
@@ -5,30 +7,14 @@ require 'graphql/cache/marshal'
5
7
 
6
8
  module GraphQL
7
9
  module Cache
8
- ConfigurationError = Class.new(StandardError)
9
-
10
- @@expiry = 5400 # 90 minutes
11
- def self.expiry; @@expiry; end
12
- def self.expiry=(obj); @@expiry=obj; end
13
-
14
- @@force = false
15
- def self.force; @@force; end
16
- def self.force=(obj); @@force=obj; end
17
-
18
- @@namespace = self.name
19
- def self.namespace; @@namespace; end
20
- def self.namespace=(obj); @@namespace=obj; end
21
-
22
- @@cache = nil
23
- def self.cache; @@cache; end
24
- def self.cache=(obj); @@cache=obj; end
25
-
26
- @@logger = nil
27
- def self.logger; @@logger; end
28
- def self.logger=(obj); @@logger=obj; end
29
-
30
- def self.configure
31
- yield self
10
+ include Gemer::Configurable
11
+
12
+ setup_config do |c|
13
+ c.attr :cache
14
+ c.attr :expiry, 5400
15
+ c.attr :force, false, in: [true, false]
16
+ c.attr :logger
17
+ c.attr :namespace, 'GraphQL::Cache'
32
18
  end
33
19
 
34
20
  def self.fetch(key, config: {}, &block)
@@ -21,8 +21,12 @@ module GraphQL
21
21
  self.field_definition = field_definition
22
22
  self.field_args = field_args
23
23
  self.query_context = query_context
24
- self.object = parent_object.object if parent_object
25
24
  self.cache = ::GraphQL::Cache.cache
25
+
26
+ return unless parent_object
27
+
28
+ self.object = parent_object.nodes if parent_object.respond_to? :nodes
29
+ self.object = parent_object.object if parent_object.respond_to? :object
26
30
  end
27
31
 
28
32
  def cache_config
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module Cache
3
- VERSION = '0.2.1'.freeze
3
+ VERSION = '0.2.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kelly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-18 00:00:00.000000000 Z
11
+ date: 2018-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,20 +94,34 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: gemer
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.1'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.1'
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: graphql
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 1.8.0.pre10
117
+ version: 1.8.0
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: 1.8.0.pre10
124
+ version: 1.8.0
111
125
  description: Provides middleware field-level caching for graphql-ruby
112
126
  email:
113
127
  - michaelkelly322@gmail.com