Class: Nexaas::Async::Collector::Storage

Inherits:
Object
  • Object
show all
Defined in:
lib/nexaas/async/collector/storage.rb

Instance Method Summary collapse

Instance Method Details

#get(key) ⇒ Object



6
7
8
9
10
# File 'lib/nexaas/async/collector/storage.rb', line 6

def get(key)
  Sidekiq.redis_pool.with do |connection|
    connection.get(namespaced_key(key))
  end
end

#set(key, value, expiration) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/nexaas/async/collector/storage.rb', line 12

def set(key, value, expiration)
  Sidekiq.redis_pool.with do |connection|
    key = namespaced_key(key)
    connection.multi do
      connection.set(key, value)
      connection.expire(key, expiration)
    end
  end
end