Sha256: a322ded1f30a057a2a0e69fd3fa8ac5165a068ff563b15c5944ec84dd18bc07a
Contents?: true
Size: 799 Bytes
Versions: 6
Compression:
Stored size: 799 Bytes
Contents
module ActiveFedora class Base def stream Nest.new(self.class.name, $redis)[to_param] rescue nil end def self.stream Nest.new(name, $redis) rescue nil end def events(size = -1) stream[:event].lrange(0, size).map do |event_id| { action: $redis.hget("events:#{event_id}", "action"), timestamp: $redis.hget("events:#{event_id}", "timestamp") } end rescue [] end def create_event(action, timestamp) event_id = $redis.incr("events:latest_id") $redis.hmset("events:#{event_id}", "action", action, "timestamp", timestamp) event_id rescue nil end def log_event(event_id) stream[:event].lpush(event_id) rescue nil end end end
Version data entries
6 entries across 6 versions & 1 rubygems