Skip to content

Commit 9d6e606

Browse files
committed
Update documentation to reflect new methods on Redis.
1 parent bca64d1 commit 9d6e606

File tree

2 files changed

+12
-34
lines changed

2 files changed

+12
-34
lines changed

lib/redis.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def call(*command)
7676

7777
# Queues a command for pipelining.
7878
#
79-
# Commands in the queue are executed with the Redis::Client#commit method.
79+
# Commands in the queue are executed with the Redis#commit method.
8080
#
8181
# See http://redis.io/topics/pipelining for more details.
8282
#

lib/redis/client.rb

Lines changed: 11 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,6 @@
33
require "cgi"
44

55
class Redis
6-
# Redis::Client handles the connection to Redis, sending and receiving commands.
7-
#
8-
# Usage:
9-
#
10-
# client = Redis::Client.new
11-
#
12-
# client.call(["PING"])
13-
# => "PONG"
14-
#
15-
# client.call(["SET", "key", "value"])
16-
# => "OK"
17-
#
18-
# client.call(["INCR", "key"])
19-
# => 1
20-
#
21-
# It provides an API for command pipelining:
22-
#
23-
# client.queue(["SET", "key", "value"])
24-
# client.queue(["GET", "key"])
25-
# client.commit
26-
# => ["OK", "value"]
27-
#
286
class Client
297

308
DEFAULTS = {
@@ -108,17 +86,6 @@ def initialize(options = {})
10886
end
10987
end
11088

111-
def call(command, &block)
112-
reply = process([command]) { read }
113-
raise reply if reply.is_a?(CommandError)
114-
115-
if block
116-
block.call(reply)
117-
else
118-
reply
119-
end
120-
end
121-
12289
def connect
12390
@pid = Process.pid
12491

@@ -141,6 +108,17 @@ def location
141108
path || "#{host}:#{port}"
142109
end
143110

111+
def call(command, &block)
112+
reply = process([command]) { read }
113+
raise reply if reply.is_a?(CommandError)
114+
115+
if block
116+
block.call(reply)
117+
else
118+
reply
119+
end
120+
end
121+
144122
def call_loop(command)
145123
error = nil
146124

0 commit comments

Comments
 (0)