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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20d4daf1d7e01d29ee5eaaf8b1edd660ce52ec89148bfc51e8daf9908909165b
4
- data.tar.gz: 9969132bc7cd53b70c5f4602afa9c17817c18177403bb17fbd77b743def7da3d
3
+ metadata.gz: d350a75806d888f784565799473875ef199104536103de749aaaef8b53f98c78
4
+ data.tar.gz: 2b71a182d6c912140bbf9838ed9210e080c4dc2ce077957797f7f1609437e500
5
5
  SHA512:
6
- metadata.gz: 02a47cb4bc8b35df3b71e1175b3df13b98044fdaf4ebc2e76a6961261490e6954e83513e68233902c16390ee0f0a32081b1fd024495b8fc99bff494dff62bebd
7
- data.tar.gz: 3807c92653c2c9222b8f49f914ca52f1966782f4bc8be43278d4e9c3c6ed7e4280cf0815a28527314eb2671859adfcf5b59dc6b0a2b1e7e39100ff0dcae4f759
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
- return true unless @config.expires_in
26
+ def path_fresh?(path, http_path, http_params)
27
+ expires_in = @config.expires_in
28
28
 
29
- path.mtime + @config.expires_in >= Time.now
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitlabClientCache
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.3"
5
5
  end
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.1
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-07 00:00:00.000000000 Z
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/splatteal/gitlab-client-cache
40
+ homepage: https://gitlab.com/splattael/gitlab-client-cache
41
41
  licenses:
42
42
  - MIT
43
43
  metadata:
44
- homepage_uri: https://gitlab.com/splatteal/gitlab-client-cache
45
- source_code_uri: https://gitlab.com/splatteal/gitlab-client-cache
46
- changelog_uri: https://gitlab.com/splatteal/gitlab-client-cache
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: