module Bramble::Storage::MemoryStorage

☠ This is for single-threaded, single-process Ruby only! If you try to use this in production, you're going to have a bad time.

Constants

STORAGE

Public Instance Methods

delete(key) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 24
def delete(key)
  STORAGE.delete(key)
end
delete_all() click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 60
def delete_all
  STORAGE.clear
end
get(key) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 20
def get(key)
  STORAGE[key]
end
increment(key) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 28
def increment(key)
  STORAGE[key] ||= 0
  STORAGE[key] += 1
end
map_keys_get(key) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 56
def map_keys_get(key)
  STORAGE[key] || Set.new
end
map_keys_push(key, value) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 51
def map_keys_push(key, value)
  STORAGE[key] ||= Set.new
  STORAGE[key] << value
end
map_result_get(key) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 38
def map_result_get(key)
  STORAGE[key] || []
end
map_result_push(key, value) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 33
def map_result_push(key, value)
  STORAGE[key] ||= []
  STORAGE[key] << value
end
reduce_result_get(storage_key) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 47
def reduce_result_get(storage_key)
  STORAGE[storage_key] || {}
end
reduce_result_set(storage_key, reduce_key, value) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 42
def reduce_result_set(storage_key, reduce_key, value)
  STORAGE[storage_key] ||= {}
  STORAGE[storage_key][reduce_key] = value
end
set(key, value) click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 16
def set(key, value)
  STORAGE[key] = value
end
transaction() { || ... } click to toggle source
# File lib/bramble/storage/memory_storage.rb, line 12
def transaction
  yield
end