Sha256: 0201471f060bf96e62624c9b58ab1844dd2f187797a1dac3d2bc0872f03c479f
Contents?: true
Size: 838 Bytes
Versions: 2
Compression:
Stored size: 838 Bytes
Contents
module Daijobu module Adapter # Daijobu::Adapter::TokyoTyrantAdapter wraps getting and setting to a Rufus::Tokyo::Tyrant store. class TokyoTyrantAdapter # Daijobu::Adapter::TokyoTyrantAdapter.new takes a Rufus::Tokyo::Tyrant object. def initialize(store) @store = store end # Gets the key or keys given, using Tyrant#[] or Tyrant#lget. # Multiple values should be returned in a hash, but that's really up to Tyrant object. def get(*keys) if keys.size == 0 nil elsif keys.size == 1 @store[keys.first] else @store.lget(keys) end end # Sets the key to the given value (using Tyrant#[]=). def set(key, value) @store[key] = value end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sander6-daijobu-0.2.1 | lib/daijobu/adapters/tokyo_tyrant.rb |
sander6-daijobu-0.3.0 | lib/daijobu/adapters/tokyo_tyrant.rb |