lib/redis.rb in redis-0.1.1 vs lib/redis.rb in redis-0.1.2
- old
+ new
@@ -29,15 +29,15 @@
"lset" => true,
"lrem" => true,
"sadd" => true,
"srem" => true,
"sismember" => true,
- "rpoplpush" => true,
"echo" => true,
"getset" => true,
"smove" => true,
"zadd" => true,
+ "zincrby" => true,
"zrem" => true,
"zscore" => true
}
MULTI_BULK_COMMANDS = {
@@ -103,16 +103,18 @@
"set_move" => "smove",
"set_unless_exists" => "setnx",
"rename_unless_exists" => "renamenx",
"type?" => "type",
"zset_add" => "zadd",
- "zset_count" => 'zcard',
- "zset_range_by_score" => 'zrangebyscore',
- "zset_reverse_range" => 'zrevrange',
- "zset_range" => 'zrange',
- "zset_delete" => 'zrem',
- "zset_score" => 'zscore'
+ "zset_count" => "zcard",
+ "zset_range_by_score" => "zrangebyscore",
+ "zset_reverse_range" => "zrevrange",
+ "zset_range" => "zrange",
+ "zset_delete" => "zrem",
+ "zset_score" => "zscore",
+ "zset_incr_by" => "zincrby",
+ "zset_increment_by" => "zincrby"
}
DISABLED_COMMANDS = {
"monitor" => true,
"sync" => true
@@ -125,10 +127,11 @@
@timeout = (options[:timeout] || 5).to_i
@password = options[:password]
@logger = options[:logger]
@thread_safe = options[:thread_safe]
@mutex = Mutex.new if @thread_safe
+ @sock = nil
@logger.info { self.to_s } if @logger
end
def to_s
@@ -192,10 +195,10 @@
connect_to_server if !@sock
begin
raw_call_command(argv.dup)
rescue Errno::ECONNRESET, Errno::EPIPE, Errno::ECONNABORTED
- @sock.close
+ @sock.close rescue nil
@sock = nil
connect_to_server
raw_call_command(argv.dup)
end
end