class DCell::Registry::MongodbAdapter::Proxy
Public Class Methods
all(storage)
click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 51 def all(storage) keys = [] storage.each do |entry| keys << entry.key end keys end
clear_all(storage)
click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 66 def clear_all(storage) storage.delete_all end
get(storage, key)
click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 43 def get(storage, key) first = storage.where(key: key).first if first and first.value return first.value['v'] end nil end
remove(storage, key)
click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 59 def remove(storage, key) begin storage.where(key: key).delete rescue end end
set(storage, key, value)
click to toggle source
# File lib/dcell/registries/mongodb_adapter.rb, line 36 def set(storage, key, value) entry = storage.find_or_create_by(key: key) entry.value = {'v' => value} entry.save! value end