caches 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/caches/stats.rb +6 -1
- data/lib/caches/version.rb +1 -1
- data/spec/caches/lru_spec.rb +1 -1
- data/spec/caches/ttl_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 413c1adc86d415334b1ff133cf124fe7f82a4831
|
4
|
+
data.tar.gz: 90d46e2b56699932fe3e1b76699fb92c37b23d7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a461ad78571ebf10c4b54fc9ec00122750b1b71754e7a2b07080c12b634009c2e02adcbc6eb0d1532ad657419752e7d4217e09a61a256ae116916926d7c7380e
|
7
|
+
data.tar.gz: e8f5022d40eecfc8c386d41ecc35812c1b071bf0b36dd518eec449e057b2b33f71f669634c792b30b7b30535a49a6dbd999f81c98ded88ac873fc59fbef2c657
|
data/CHANGELOG.md
CHANGED
data/lib/caches/stats.rb
CHANGED
@@ -8,7 +8,7 @@ module Caches
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def stats
|
11
|
-
{hits: @hits, misses: @misses}
|
11
|
+
{hits: @hits, misses: @misses, hit_rate: hit_rate}
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -21,5 +21,10 @@ module Caches
|
|
21
21
|
@misses += 1
|
22
22
|
end
|
23
23
|
|
24
|
+
def hit_rate
|
25
|
+
rate = (Float(@hits) / (Float(@hits) + Float(@misses)))
|
26
|
+
"#{rate * 100}%"
|
27
|
+
end
|
28
|
+
|
24
29
|
end
|
25
30
|
end
|
data/lib/caches/version.rb
CHANGED
data/spec/caches/lru_spec.rb
CHANGED
data/spec/caches/ttl_spec.rb
CHANGED