class TieredCaching::AsyncStore

Public Class Methods

new(store_pool, executor) click to toggle source
# File lib/tiered_caching/async_store.rb, line 4
def initialize(store_pool, executor)
  @store_pool = store_pool
  @executor = executor
end

Public Instance Methods

clear() click to toggle source
# File lib/tiered_caching/async_store.rb, line 28
def clear
  internal_store { |conn| conn.clear }
end
delete(key) click to toggle source
# File lib/tiered_caching/async_store.rb, line 24
def delete(key)
  internal_store { |conn| conn.delete(key) }
end
get(key) click to toggle source
# File lib/tiered_caching/async_store.rb, line 16
def get(key)
  internal_store { |conn| conn.get(key) }
end
getset(key, &block) click to toggle source
# File lib/tiered_caching/async_store.rb, line 20
def getset(key, &block)
  internal_store { |conn| conn.getset(key, &block) }
end
set(key, value) click to toggle source
# File lib/tiered_caching/async_store.rb, line 9
def set(key, value)
  Concurrent::Future.execute(executor: @executor) do
    internal_store { |conn| conn.set(key, value) }
  end
  value
end

Private Instance Methods

internal_store(&block) click to toggle source
# File lib/tiered_caching/async_store.rb, line 34
def internal_store(&block)
  @store_pool.with(&block)
end