Sha256: 4b7fe53ea0f1c914d456372fc07adc150b1f2aa01168bea916edf7b034b94a6a
Contents?: true
Size: 923 Bytes
Versions: 2
Compression:
Stored size: 923 Bytes
Contents
module RailsIdle module Storage class RailsCache < Base def add(path, execution_time = nil) super if execution_time increment(path, COUNTER_KEY) increment(path, EXECUTION_KEY, (execution_time * 1000).round) end end 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 def reset(path) [COUNTER_KEY, EXECUTION_KEY].each do |key| Rails.cache.delete build_name(path, key) end end private def increment(path, key, amount = 1) Rails.cache.increment build_name(path, key), amount end def build_name(path, key) "#{RailsIdle}.#{path}.#{key}" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rails-idle-0.0.10 | lib/rails-idle/storage/rails_cache.rb |
rails-idle-0.0.9 | lib/rails-idle/storage/rails_cache.rb |