api-response-cache 0.4.2 → 0.4.3
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 +4 -4
- data/lib/api_response_cache/api_cache_handler.rb +11 -7
- data/lib/api_response_cache/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92ae9876badd7c10eba5260f8a725c90f8719352d154c211ed1c9673db158134
|
4
|
+
data.tar.gz: 4410d78e70c18911bc0131c9cc5649bfd3b359668249b900a47e756ec0a84bf4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ebbef4f266925f62cadc9c5985a82244025d0a4da3511c5bc6aa964af4a56d717c2df2ef8bd74d6e8d8d088d0b5d28f641ac6bbc405581e4386d2e4e918152
|
7
|
+
data.tar.gz: daf37af1b2a8ebd32d586287a7d97545c5af9f2f370d9ce5f4091eac4635afc18397108789eb8b6766d7f7add0aa36edb4d94ae8ac16db2ef10d4e230e2d52c5
|
@@ -14,7 +14,7 @@ module ApiResponseCache
|
|
14
14
|
render_cached_response
|
15
15
|
else
|
16
16
|
yield
|
17
|
-
@response_cache.write_cache(controller.response)
|
17
|
+
@response_cache.write_cache(controller.response) if @request.get?
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -25,23 +25,27 @@ module ApiResponseCache
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def log_info
|
28
|
-
processor
|
29
|
-
responder
|
28
|
+
processor = "#{@controller.class.name}##{@controller.action_name}".blue
|
29
|
+
responder = Rainbow('API Response Cache').green
|
30
30
|
Rails.logger.info "=== #{processor} response by #{responder} ==="
|
31
31
|
end
|
32
32
|
|
33
33
|
def init(controller)
|
34
34
|
@controller = controller
|
35
35
|
@request = controller.request
|
36
|
-
@processor_name = "#{@controller.class.name}##{@controller.action_name}"
|
37
36
|
@response_cache = ResponseCache.new(cache_path, @expires_in)
|
38
37
|
end
|
39
38
|
|
40
39
|
def cache_path
|
41
|
-
@cache_path = "api-response-cache
|
40
|
+
@cache_path = "api-response-cache"
|
42
41
|
|
43
|
-
if
|
44
|
-
@cache_path = "#{@cache_path}
|
42
|
+
if @options[:cache_path].present?
|
43
|
+
@cache_path = "#{@cache_path}/#{@options[:cache_path]}"
|
44
|
+
elsif ApiResponseCache.configuration.refresh_by_request_params?
|
45
|
+
@cache_path = "#{@cache_path}/#{@request.fullpath}"
|
46
|
+
else
|
47
|
+
path_only = @request.fullpath.split('?').first
|
48
|
+
@cache_path = "#{@cache_path}/#{path_only}"
|
45
49
|
end
|
46
50
|
|
47
51
|
if ApiResponseCache.configuration.cache_by_headers.present?
|
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.
|
4
|
+
version: 0.4.3
|
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-07-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|