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



85
86
87
88
89
90
# File 'lib/roundhouse_ui/snapshots.rb', line 85

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

#idsObject



92
93
94
# File 'lib/roundhouse_ui/snapshots.rb', line 92

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

#read(id) ⇒ Object



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

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

#write(id, blob) ⇒ Object



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

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