sin_lru_redux 2.2.0 → 2.2.1

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: 3a4f3922e84907ba0de45efa46ee990b5947f28a7cd0c636de9ed268bc8a2335
4
- data.tar.gz: 4e0da38bf6e25d814751eb2304a409dde4da530db49dc17b9c7fbd44ddb16e1b
3
+ metadata.gz: 62aedb1e0b7730269fe2f336ae70bdfd158cf38efd0827c8fae3bd4810e4b0dc
4
+ data.tar.gz: db0572e99799e265c3d6b8d52072c779574e1cc29e6ca73ce24fe982768d90ce
5
5
  SHA512:
6
- metadata.gz: ce0f773d075691a31efb284a2ce23f860cf225d38450020ca32a280e22fb39a1941e79f0c7adb775fbf07c5bf1ecd93241b55b468b500abbc64f2698bfa6e60e
7
- data.tar.gz: 58b1096ed7841aa618080bd85fbe00d42f056e8784cf9ce0ee03ec5b82792bfcd497abd9c90026e1374b5b513804f78c517ec5f648bef80ed23b94db4b650bd4
6
+ metadata.gz: bd3b6ab784cf9318ce46aa572b4e0c3c7e316147e1a56404a8c316a104a67c4b12f5e3805c6f349b0e98fa54773ba53ba7fa532d6e7f6f91a1c442dc10a436ca
7
+ data.tar.gz: 34126e658fce4a4c1ee29587ee598d72e2068c1c99cec359d0c373c13a0d271aefe53119b22ddda3e055b78b6e75c3c1d02964ea7301a76c45457216a68b4fe2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.1] - 2024-12-31
4
+
5
+ - Refactor: Improve implementation
6
+ - Test: Improve tests
7
+
3
8
  ## [2.2.0] - 2024-12-31
4
9
 
5
10
  - New: Raise an error when trying to assign nil to max_size, ttl, or ignore_nil
@@ -187,6 +187,13 @@ module LruRedux
187
187
  raise ArgumentError.new("Invalid ignore_nil: #{ignore_nil.inspect}")
188
188
  end
189
189
 
190
+ def evict_excess
191
+ while @data_lru.size > @max_size
192
+ @data_lru.shift
193
+ @data_ttl.shift
194
+ end
195
+ end
196
+
190
197
  def evict_expired
191
198
  return if @ttl == :none
192
199
 
@@ -199,18 +206,6 @@ module LruRedux
199
206
  end
200
207
  end
201
208
 
202
- def evict_excess
203
- evict_least_recently_used while @data_lru.size > @max_size
204
- end
205
-
206
- def evict_least_recently_used
207
- return if @data_lru.empty?
208
-
209
- oldest_key, _value = @data_lru.first
210
- @data_lru.delete(oldest_key)
211
- @data_ttl.delete(oldest_key)
212
- end
213
-
214
209
  def evict_nil
215
210
  return unless @ignore_nil
216
211
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LruRedux
4
- VERSION = '2.2.0'
4
+ VERSION = '2.2.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sin_lru_redux
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro
@@ -33,15 +33,15 @@ files:
33
33
  - lib/lru_redux/util.rb
34
34
  - lib/lru_redux/util/safe_sync.rb
35
35
  - lib/lru_redux/version.rb
36
- homepage: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.0
36
+ homepage: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.1
37
37
  licenses:
38
38
  - MIT
39
39
  metadata:
40
- homepage_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.0
41
- source_code_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.0
42
- changelog_uri: https://github.com/cadenza-tech/sin_lru_redux/blob/v2.2.0/CHANGELOG.md
40
+ homepage_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.1
41
+ source_code_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.1
42
+ changelog_uri: https://github.com/cadenza-tech/sin_lru_redux/blob/v2.2.1/CHANGELOG.md
43
43
  bug_tracker_uri: https://github.com/cadenza-tech/sin_lru_redux/issues
44
- documentation_uri: https://rubydoc.info/gems/sin_lru_redux/2.2.0
44
+ documentation_uri: https://rubydoc.info/gems/sin_lru_redux/2.2.1
45
45
  rubygems_mfa_required: 'true'
46
46
  rdoc_options: []
47
47
  require_paths: