api-response-cache 0.3.0 → 0.4.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42d4dc9cfef92cb3f4baaecdfa34051a6dd3b73ac2d2b3f597347e833a32e913
|
4
|
+
data.tar.gz: 6ba96e207df137c01dc292efc41ce9c3faf9cc075f483dbcfb82144623c18329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea83d1da2fb887f325a2c01a3ef2364818fa595cddc16a087e8812b9206d978cd33f9ef5ff01c3b79f8be9be45abb11b3f73bfe937d967478c308c7f66cfe30f
|
7
|
+
data.tar.gz: 19b059aea1fb096b7d2bcd76d7d5b3642b7a00da108bcd3753e9c4261bd5ed423028944964c72013a683815ccb4728ac16058b36ff0e7691f2ab339d4c7410d6
|
@@ -34,11 +34,19 @@ module ApiResponseCache
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def cache_path
|
37
|
-
return @cache_path if @cache_path.present?
|
38
37
|
@cache_path = "api-response-cache/#{@processor_name || @options[:cache_path]}"
|
38
|
+
|
39
39
|
if ApiResponseCache.configuration.refresh_by_request_params?
|
40
|
-
@cache_path = "#{@cache_path}
|
40
|
+
@cache_path = "#{@cache_path}#{@request.fullpath}"
|
41
|
+
end
|
42
|
+
|
43
|
+
if ApiResponseCache.configuration.cache_by_headers.present?
|
44
|
+
cache_by_headers = ApiResponseCache.configuration.cache_by_headers
|
45
|
+
headers = @request.headers.select{ |key, value| cache_by_headers.include?(key) }
|
46
|
+
headers_cache_path = headers.to_json
|
47
|
+
@cache_path = "#{@cache_path}/#{headers_cache_path}"
|
41
48
|
end
|
49
|
+
|
42
50
|
@cache_path
|
43
51
|
end
|
44
52
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
module ApiResponseCache
|
2
2
|
class Config
|
3
|
-
attr_accessor :refresh_by_request_params
|
3
|
+
attr_accessor :refresh_by_request_params, :cache_by_headers
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@refresh_by_request_params = false
|
7
7
|
end
|
8
8
|
|
9
|
-
|
10
9
|
def refresh_by_request_params?
|
11
|
-
refresh_by_request_params
|
10
|
+
@refresh_by_request_params
|
12
11
|
end
|
12
|
+
|
13
13
|
end
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api-response-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Uysim Ty
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-06-
|
11
|
+
date: 2018-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|