elock-client 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/elock-client.rb +16 -0
- metadata +1 -1
data/lib/elock-client.rb
CHANGED
@@ -29,6 +29,22 @@ class ELock
|
|
29
29
|
do_cmd("unlock_all")
|
30
30
|
end
|
31
31
|
|
32
|
+
# Get server stats
|
33
|
+
def stats
|
34
|
+
@socket.write("stats\r\n")
|
35
|
+
line = @socket.gets("\r\n")
|
36
|
+
rv={}
|
37
|
+
if line.to_i == 200
|
38
|
+
line = @socket.gets("\r\n").strip
|
39
|
+
while line != 'END'
|
40
|
+
s, name, val=line.split
|
41
|
+
rv[name]=val
|
42
|
+
line = @socket.gets("\r\n").strip
|
43
|
+
end
|
44
|
+
end
|
45
|
+
rv
|
46
|
+
end
|
47
|
+
|
32
48
|
# Run a block while holding the named lock.
|
33
49
|
# raises Locked if the lock could not be acquired.
|
34
50
|
def with_lock(name, timeout=nil)
|