class GoFlippy::MemoryStore

Public Class Methods

new() click to toggle source
# File lib/goflippy-ruby/memory_store.rb, line 5
def initialize
  @store = Concurrent::Hash.new({})
end

Public Instance Methods

find(key) click to toggle source
# File lib/goflippy-ruby/memory_store.rb, line 9
def find(key)
  @store[key]
end
put(key, val) click to toggle source
# File lib/goflippy-ruby/memory_store.rb, line 13
def put(key, val)
  @store[key.to_sym] = val
end
refresh!(keys) click to toggle source
# File lib/goflippy-ruby/memory_store.rb, line 17
def refresh!(keys)
  @store = Concurrent::Hash.new(@store.select { |k, _| keys.include?(k) })
end