semian 0.10.0 → 0.10.1
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/semian/lru_hash.rb +16 -4
- data/lib/semian/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36febd25cb5eb31a718290a1a0a7e459357b38465d4ec85711f90ea479341eb8
|
4
|
+
data.tar.gz: b77a33d7e59940c87f44d85fe6e5deb15a74befc5ca678a643fcea85fa0fdcdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ad770b1ee2e73b60fec5a14928a0d580f84c6a824b98cf3ccaa298aa5048c60da4ec86d76c11a302a0188e66e1cbfacc98845ff10b49caaa1512ff0878a4db1
|
7
|
+
data.tar.gz: a176783ad0297ced3e36df28e93a005d55f9127bfca2e1fd11f281a853b098bb6eb9836ae63e7bb4ed998b1285ff7138d2993f432a2300a6cbb675c180d73847
|
data/lib/semian/lru_hash.rb
CHANGED
@@ -5,10 +5,6 @@ class LRUHash
|
|
5
5
|
# everytime we set a new resource. A default window of
|
6
6
|
# 5 minutes will allow empty item to stay in the hash
|
7
7
|
# for a maximum of 5 minutes
|
8
|
-
extend Forwardable
|
9
|
-
def_delegators :@table, :size, :count, :empty?, :values
|
10
|
-
attr_reader :table
|
11
|
-
|
12
8
|
class NoopMutex
|
13
9
|
def synchronize(*)
|
14
10
|
yield
|
@@ -65,6 +61,22 @@ class LRUHash
|
|
65
61
|
end
|
66
62
|
end
|
67
63
|
|
64
|
+
def size
|
65
|
+
@lock.synchronize { @table.size }
|
66
|
+
end
|
67
|
+
|
68
|
+
def count(&block)
|
69
|
+
@lock.synchronize { @table.count(&block) }
|
70
|
+
end
|
71
|
+
|
72
|
+
def empty?
|
73
|
+
@lock.synchronize { @table.empty? }
|
74
|
+
end
|
75
|
+
|
76
|
+
def values
|
77
|
+
@lock.synchronize { @table.values }
|
78
|
+
end
|
79
|
+
|
68
80
|
def set(key, resource)
|
69
81
|
@lock.synchronize do
|
70
82
|
@table.delete(key)
|
data/lib/semian/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semian
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Francis
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2020-03-31 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake-compiler
|
@@ -234,7 +234,8 @@ files:
|
|
234
234
|
homepage: https://github.com/shopify/semian
|
235
235
|
licenses:
|
236
236
|
- MIT
|
237
|
-
metadata:
|
237
|
+
metadata:
|
238
|
+
allowed_push_host: https://rubygems.org
|
238
239
|
post_install_message:
|
239
240
|
rdoc_options: []
|
240
241
|
require_paths:
|