gitlab-client-cache 0.0.1 → 0.0.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/gitlab/client/cache/caching.rb +14 -4
- data/lib/gitlab/client/cache/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d350a75806d888f784565799473875ef199104536103de749aaaef8b53f98c78
|
4
|
+
data.tar.gz: 2b71a182d6c912140bbf9838ed9210e080c4dc2ce077957797f7f1609437e500
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26883d8c2693da2bf08e33366eac75772f39bbb2948229c5110ffe4937757088f6f5f6410a1e76db6414b832e93fa8ac3c148e8e69133d5a4ec29cba17533542
|
7
|
+
data.tar.gz: 516973e271b58a4bff32383024dbaa7b72310ffc63be65d09c6b1e49bcc35a0c69abea9b6bc0c7227287298ae9ac02856a8a618f120a8847804cba5304fb837b
|
@@ -14,7 +14,7 @@ class Gitlab::Client::Cache::Caching
|
|
14
14
|
def cached(http_path, http_params)
|
15
15
|
path = path_to(http_path, http_params)
|
16
16
|
|
17
|
-
if path.exist? && path_fresh?(path)
|
17
|
+
if path.exist? && path_fresh?(path, http_path, http_params)
|
18
18
|
load(path)
|
19
19
|
else
|
20
20
|
dump(path, yield)
|
@@ -23,10 +23,20 @@ class Gitlab::Client::Cache::Caching
|
|
23
23
|
|
24
24
|
private
|
25
25
|
|
26
|
-
def path_fresh?(path)
|
27
|
-
|
26
|
+
def path_fresh?(path, http_path, http_params)
|
27
|
+
expires_in = @config.expires_in
|
28
28
|
|
29
|
-
|
29
|
+
if expires_in.is_a?(Array)
|
30
|
+
expires_in = \
|
31
|
+
expires_in.each do |block|
|
32
|
+
result = block.is_a?(Proc) ? block.call(http_path, http_params) : block
|
33
|
+
break result unless result == :default
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
return true unless expires_in
|
38
|
+
|
39
|
+
path.mtime + expires_in >= Time.now
|
30
40
|
end
|
31
41
|
|
32
42
|
def load(path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-client-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Leitzen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-12-
|
11
|
+
date: 2023-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitlab
|
@@ -37,13 +37,13 @@ files:
|
|
37
37
|
- lib/gitlab/client/cache/config.rb
|
38
38
|
- lib/gitlab/client/cache/patch.rb
|
39
39
|
- lib/gitlab/client/cache/version.rb
|
40
|
-
homepage: https://gitlab.com/
|
40
|
+
homepage: https://gitlab.com/splattael/gitlab-client-cache
|
41
41
|
licenses:
|
42
42
|
- MIT
|
43
43
|
metadata:
|
44
|
-
homepage_uri: https://gitlab.com/
|
45
|
-
source_code_uri: https://gitlab.com/
|
46
|
-
changelog_uri: https://gitlab.com/
|
44
|
+
homepage_uri: https://gitlab.com/splattael/gitlab-client-cache
|
45
|
+
source_code_uri: https://gitlab.com/splattael/gitlab-client-cache
|
46
|
+
changelog_uri: https://gitlab.com/splattael/gitlab-client-cache
|
47
47
|
post_install_message:
|
48
48
|
rdoc_options: []
|
49
49
|
require_paths:
|