lib/dalli/client.rb in dalli-0.9.8 vs lib/dalli/client.rb in dalli-0.9.9
- old
+ new
@@ -22,10 +22,22 @@
#
# The standard memcached instruction set
#
+ ##
+ # Turn on quiet aka noreply support.
+ # All relevant operations within this block with be effectively
+ # pipelined as Dalli will use 'quiet' operations where possible.
+ # Currently supports the set, add, replace and delete operations.
+ def multi
+ Thread.current[:multi] = true
+ yield
+ ensure
+ Thread.current[:multi] = nil
+ end
+
def get(key, options=nil)
resp = perform(:get, key)
(!resp || resp == 'Not found') ? nil : deserialize(resp, options)
end
@@ -161,10 +173,10 @@
end
# Chokepoint method for instrumentation
def perform(op, *args)
key = args.first
- if key.is_a?(Symbol)
+ if !key.is_a?(String)
key = key.to_s
args[0] = key
end
args[0] = key = validate_key(key)
server = ring.server_for_key(key)
\ No newline at end of file