Class: DistributedTrie::KvsMemcache
- Defined in:
- lib/distributedtrie/kvs/memcache.rb
Overview
Memcache client implementation
Instance Method Summary collapse
-
#initialize(host = "localhost", port = "1978") ⇒ KvsMemcache
constructor
A new instance of KvsMemcache.
- #put!(key, value, timeout = 0) ⇒ Object
Methods inherited from KvsBase
Methods inherited from KvsIf
Constructor Details
#initialize(host = "localhost", port = "1978") ⇒ KvsMemcache
Returns a new instance of KvsMemcache.
41 42 43 44 45 46 |
# File 'lib/distributedtrie/kvs/memcache.rb', line 41 def initialize( host = "localhost", port = "1978" ) @db = MemCache.new( host + ":" + port, :connect_timeout => 1000.0, :timeout => 1000.0 ) end |
Instance Method Details
#put!(key, value, timeout = 0) ⇒ Object
48 49 50 |
# File 'lib/distributedtrie/kvs/memcache.rb', line 48 def put!( key, value, timeout = 0 ) @db.set( key.force_encoding("ASCII-8BIT"), value.force_encoding("ASCII-8BIT"), timeout ) end |