Class: RoundhouseUi::Snapshots::RedisStore

Inherits:
Object
  • Object
show all
Defined in:
lib/roundhouse_ui/snapshots.rb

Overview

Default store: blobs + an index set, all in Redis.

Constant Summary collapse

INDEX =
"roundhouse:snapshots"

Instance Method Summary collapse

Instance Method Details

#delete(id) ⇒ Object



74
75
76
77
78
79
# File 'lib/roundhouse_ui/snapshots.rb', line 74

def delete(id)
  Sidekiq.redis do |conn|
    conn.call("DEL", key(id))
    conn.call("SREM", INDEX, id)
  end
end

#idsObject



81
82
83
# File 'lib/roundhouse_ui/snapshots.rb', line 81

def ids
  Sidekiq.redis { |conn| conn.call("SMEMBERS", INDEX) }
end

#read(id) ⇒ Object



70
71
72
# File 'lib/roundhouse_ui/snapshots.rb', line 70

def read(id)
  Sidekiq.redis { |conn| conn.call("GET", key(id)) }
end

#write(id, blob) ⇒ Object



63
64
65
66
67
68
# File 'lib/roundhouse_ui/snapshots.rb', line 63

def write(id, blob)
  Sidekiq.redis do |conn|
    conn.call("SET", key(id), blob)
    conn.call("SADD", INDEX, id)
  end
end