sized_list 0.2.1 → 0.2.2
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.
- data/VERSION +1 -1
- data/lib/active_support/cache/lru.rb +1 -0
- data/lib/sized_list.rb +5 -2
- data/sized_list.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -61,6 +61,7 @@ module ActiveSupport
|
|
61
61
|
payload[:eviction] = @sized_list.evicted?
|
62
62
|
payload[:total_evictions] = @sized_list.evictions
|
63
63
|
payload[:eviction_frequency] = @sized_list.eviction_frequency
|
64
|
+
payload[:last_time_between_evictions] = @sized_list.last_time_between_evictions
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
data/lib/sized_list.rb
CHANGED
@@ -9,7 +9,8 @@ class SizedList
|
|
9
9
|
attr_reader :hits,
|
10
10
|
:misses,
|
11
11
|
:writes,
|
12
|
-
:evictions
|
12
|
+
:evictions,
|
13
|
+
:last_time_between_evictions
|
13
14
|
|
14
15
|
def initialize(max_size)
|
15
16
|
@max_size = max_size
|
@@ -24,6 +25,7 @@ class SizedList
|
|
24
25
|
@writes = 0
|
25
26
|
@evictions = 0
|
26
27
|
@total_eviction_time = 0.0
|
28
|
+
@last_time_between_evictions = 0.0
|
27
29
|
@last_evicted_at = nil
|
28
30
|
end
|
29
31
|
|
@@ -103,7 +105,8 @@ class SizedList
|
|
103
105
|
if @enable_time_based_stats
|
104
106
|
now = Time.now
|
105
107
|
if @last_evicted_at
|
106
|
-
@
|
108
|
+
@last_time_between_evictions = now - @last_evicted_at
|
109
|
+
@total_eviction_time += @last_time_between_evictions
|
107
110
|
end
|
108
111
|
@last_evicted_at = now
|
109
112
|
end
|
data/sized_list.gemspec
CHANGED