zache 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zache.rb +9 -0
- data/test/test_zache.rb +1 -0
- data/zache.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbc07440cf1bc314b4a2d64f2dbd2f96509fa241f4e9e6e4f3dd5a32a0ec7adf
|
4
|
+
data.tar.gz: 4cb895d3b70c72bc03366207adb245b7ca38773626e71cc118e8aae412d1b349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f76c45b4f213d7df68cdb261eb4ba748191a6bd61e80b90ea438c1a353b7e648efa79175662afc8ce6081b60759b617884f6dbc97d40c84decdeeb16ad17a31e
|
7
|
+
data.tar.gz: e1c6a58bd8ac9d63e7da8abfcdc6fd7f729b90da5115b14006268360afa7857618af1003ef286b154529580808be75915e7b44d9e2bae1104133fd9759151a22
|
data/lib/zache.rb
CHANGED
@@ -41,6 +41,10 @@ class Zache
|
|
41
41
|
# does. It implements all methods of the original class, but doesn't do
|
42
42
|
# any caching. This is very useful for testing.
|
43
43
|
class Fake
|
44
|
+
def size
|
45
|
+
1
|
46
|
+
end
|
47
|
+
|
44
48
|
def get(*)
|
45
49
|
yield
|
46
50
|
end
|
@@ -76,6 +80,11 @@ class Zache
|
|
76
80
|
@mutex = Mutex.new
|
77
81
|
end
|
78
82
|
|
83
|
+
# Total number of keys currently in cache.
|
84
|
+
def size
|
85
|
+
@hash.size
|
86
|
+
end
|
87
|
+
|
79
88
|
# Gets the value from the cache by the provided key. If the value is not
|
80
89
|
# found in the cache, it will be calculated via the provided block. If
|
81
90
|
# the block is not given, an exception will be raised. The lifetime
|
data/test/test_zache.rb
CHANGED
data/zache.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.rubygems_version = '2.5'
|
32
32
|
s.required_ruby_version = '>=2.5'
|
33
33
|
s.name = 'zache'
|
34
|
-
s.version = '0.
|
34
|
+
s.version = '0.7.0'
|
35
35
|
s.license = 'MIT'
|
36
36
|
s.summary = 'In-memory Cache'
|
37
37
|
s.description = 'Zero-footprint in-memory thread-safe cache'
|