Class: RailsIdle::Storage::RailsCache
- Defined in:
- lib/rails-idle/storage/rails_cache.rb
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#add(path, execution_time = nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/rails-idle/storage/rails_cache.rb', line 5 def add(path, execution_time = nil) super if execution_time increment(path, COUNTER_KEY) increment(path, EXECUTION_KEY, (execution_time * 1000).round) end end |
#get(path, key) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rails-idle/storage/rails_cache.rb', line 13 def get(path, key) begin Rails.cache.read build_name(path, key) rescue Exception => e # Redis workaround (Rails.cache.read build_name(path, key), raw: true).to_i end end |
#reset(path) ⇒ Object
21 22 23 24 25 |
# File 'lib/rails-idle/storage/rails_cache.rb', line 21 def reset(path) [COUNTER_KEY, EXECUTION_KEY].each do |key| Rails.cache.delete build_name(path, key) end end |