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 +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/lru_redux/ttl/cache.rb +7 -12
- data/lib/lru_redux/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: 62aedb1e0b7730269fe2f336ae70bdfd158cf38efd0827c8fae3bd4810e4b0dc
|
4
|
+
data.tar.gz: db0572e99799e265c3d6b8d52072c779574e1cc29e6ca73ce24fe982768d90ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd3b6ab784cf9318ce46aa572b4e0c3c7e316147e1a56404a8c316a104a67c4b12f5e3805c6f349b0e98fa54773ba53ba7fa532d6e7f6f91a1c442dc10a436ca
|
7
|
+
data.tar.gz: 34126e658fce4a4c1ee29587ee598d72e2068c1c99cec359d0c373c13a0d271aefe53119b22ddda3e055b78b6e75c3c1d02964ea7301a76c45457216a68b4fe2
|
data/CHANGELOG.md
CHANGED
data/lib/lru_redux/ttl/cache.rb
CHANGED
@@ -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
|
|
data/lib/lru_redux/version.rb
CHANGED
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.
|
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.
|
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.
|
41
|
-
source_code_uri: https://github.com/cadenza-tech/sin_lru_redux/tree/v2.2.
|
42
|
-
changelog_uri: https://github.com/cadenza-tech/sin_lru_redux/blob/v2.2.
|
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.
|
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:
|