Class: MemoryTracker::Stores::InMemoryStore::Manager
- Defined in:
- lib/memory_tracker/stores/in_memory_store.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Manager
constructor
A new instance of Manager.
- #push(request) ⇒ Object
- #stats ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(opts = {}) ⇒ Manager
Returns a new instance of Manager.
7 8 9 10 11 12 |
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 7 def initialize(opts = {}) @length = opts.fetch(:window_length, 60*60*4) @window1 = StatInterval.new(Time.now - @length/2, @length) @window2 = StatInterval.new(Time.now, @length) end |
Instance Method Details
#push(request) ⇒ Object
15 16 17 18 19 |
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 15 def push(request) rotate_windows @window1.push(request) @window2.push(request) end |
#stats ⇒ Object
21 22 23 24 |
# File 'lib/memory_tracker/stores/in_memory_store.rb', line 21 def stats rotate_windows @window1.stats end |