atomic_cache 0.5.4.rc1 → 0.6.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: e912c124c9879b3208c849a21f6f82a665ddc0f3ab1e268a1355d6cfb7bda54a
4
- data.tar.gz: 3fc8b8814852f95414e8c699fb2b6f17d4c0a0516f7bc12dbdb2d167096604ac
3
+ metadata.gz: dcaffcae537b2453a12833e2087d17fbfc1d4dc0ab5b28666b3831a7a8f5ea3f
4
+ data.tar.gz: 2b503a54568a2489b835880a998306b11370c656fbaea7ac29785e27bb934fe2
5
5
  SHA512:
6
- metadata.gz: 5104f60b2f4f9d2816a53e7a19dcf58eda5e245b052c1d048c586cae8df985e0eb17f58c13bdc8dc07db4bb50607d033cb57c7a701db50a896955575cc710e3b
7
- data.tar.gz: bae2d03aac48378a6075d648c9131cf265271192658e30b5191a6bb82735e7a4aae0162d62b0c4153ed46ad16d9375cf8c832bd899b408e3ab7a9617710d2f71
6
+ metadata.gz: b43647ad82fd5e134b818aa098e0fc3b5eed7d8fb0b9b870b7655112c784b5eff01ec3893f5b63db37bf5f35db33cfcf1de8c8ac1c698b614d1f04cc04a2f2e5
7
+ data.tar.gz: 637e6b6b07ba7217af18e5dc8964bb70dcf6a4ad4b0755c49d28c6142759bdc9341aacd0f35c721646ce4075fadd04f8b0aa67c8175df4516c68d72d19bfa8db
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  # atomic_cache Gem
2
2
  [![Gem Version](https://badge.fury.io/rb/atomic_cache.svg)](https://badge.fury.io/rb/atomic_cache)
3
- [![Build Status](https://travis-ci.com/Ibotta/atomic_cache.svg?branch=main)](https://travis-ci.com/Ibotta/atomic_cache)
4
3
  [![Test Coverage](https://api.codeclimate.com/v1/badges/790faad5866d2a00ca6c/test_coverage)](https://codeclimate.com/github/Ibotta/atomic_cache/test_coverage)
5
4
 
6
5
  ## User Documentation
@@ -34,7 +34,7 @@ module AtomicCache
34
34
  # @option options [Numeric] :max_retries (5) Max times to rety in waiting case
35
35
  # @option options [Numeric] :backoff_duration_ms (50) Duration in ms to wait between retries
36
36
  # @yield Generates a new value when cache is expired
37
- def fetch(keyspace, options={})
37
+ def fetch(keyspace, options={}, &blk)
38
38
  key = @timestamp_manager.current_key(keyspace)
39
39
  tags = ["cache_keyspace:#{keyspace.root}"]
40
40
 
@@ -51,7 +51,7 @@ module AtomicCache
51
51
 
52
52
  # try to generate a new value if another process already isn't
53
53
  if block_given?
54
- new_value = generate_and_store(keyspace, options, tags, &Proc.new)
54
+ new_value = generate_and_store(keyspace, options, tags, &blk)
55
55
  return new_value unless new_value.nil?
56
56
  end
57
57
 
@@ -148,7 +148,7 @@ module AtomicCache
148
148
  end
149
149
 
150
150
  metrics(:increment, 'wait.give-up')
151
- log(:warn, "Giving up waiting. Exceeded max retries (#{max_retries}).")
151
+ log(:warn, "Giving up waiting. Exceeded max retries (#{max_retries}) for root #{keyspace.root}.")
152
152
  nil
153
153
  end
154
154
 
@@ -164,9 +164,9 @@ module AtomicCache
164
164
  @metrics.send(method, *args) if @metrics.present?
165
165
  end
166
166
 
167
- def time(*args)
167
+ def time(*args, &blk)
168
168
  if @metrics.present?
169
- @metrics.time(*args, &Proc.new)
169
+ @metrics.time(*args, &blk)
170
170
  else
171
171
  yield
172
172
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AtomicCache
4
- VERSION = "0.5.4.rc1"
4
+ VERSION = "0.6.0"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4.rc1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ibotta Developers
8
8
  - Titus Stone
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-08-12 00:00:00.000000000 Z
12
+ date: 2023-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -29,30 +29,30 @@ dependencies:
29
29
  name: gems
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '1.0'
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '1.0'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: git
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '1.3'
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '1.3'
55
+ version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: github_changelog_generator
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -85,58 +85,58 @@ dependencies:
85
85
  name: rake
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: '10.0'
90
+ version: '0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: '10.0'
97
+ version: '0'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: rspec
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: '3.0'
104
+ version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - "~>"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: '3.0'
111
+ version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: simplecov
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
- - - "~>"
116
+ - - ">="
117
117
  - !ruby/object:Gem::Version
118
- version: '0.15'
118
+ version: '0'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
- - - "~>"
123
+ - - ">="
124
124
  - !ruby/object:Gem::Version
125
- version: '0.15'
125
+ version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: timecop
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
- - - "~>"
130
+ - - ">="
131
131
  - !ruby/object:Gem::Version
132
- version: 0.8.1
132
+ version: '0'
133
133
  type: :development
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
- - - "~>"
137
+ - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 0.8.1
139
+ version: '0'
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: pry
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -220,7 +220,7 @@ homepage: https://github.com/ibotta/atomic_cache
220
220
  licenses:
221
221
  - Apache-2.0
222
222
  metadata: {}
223
- post_install_message:
223
+ post_install_message:
224
224
  rdoc_options: []
225
225
  require_paths:
226
226
  - lib
@@ -231,12 +231,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
231
231
  version: '0'
232
232
  required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  requirements:
234
- - - ">"
234
+ - - ">="
235
235
  - !ruby/object:Gem::Version
236
- version: 1.3.1
236
+ version: '0'
237
237
  requirements: []
238
- rubygems_version: 3.0.8
239
- signing_key:
238
+ rubygems_version: 3.1.6
239
+ signing_key:
240
240
  specification_version: 4
241
241
  summary: In a nutshell:* The key of every cached value includes a timestamp* Once
242
242
  a cache key is written to, it is never written over* When a newer version of a cached