class Bario::Storage
Internal storage backed in redis for bar
Constants
- Timestamp
Extracted from ohm-contrib
Public Class Methods
time_now()
click to toggle source
# File lib/bario/storage.rb, line 25 def time_now Time.now.utc.to_i end
Public Instance Methods
increment(att, count = 1)
click to toggle source
Override increment update `updated_at` attribute `decrement` call to `increment`.
# File lib/bario/storage.rb, line 40 def increment(att, count = 1) time_now = self.class.time_now redis.queue("HINCRBY", key[:counters], att, count) redis.queue("HSET", key, "updated_at", time_now) self.updated_at = time_now redis.commit end
save()
click to toggle source
Calls superclass method
# File lib/bario/storage.rb, line 30 def save time_now = self.class.time_now self.created_at = time_now if new? self.updated_at = time_now super end