Permalink
Browse files

Add brpop and brpoplpush

  • Loading branch information...
arohner committed Feb 16, 2012
1 parent 16d7a44 commit bdf369e40b10010e07ee4ec981423924a0d8e5c9
Showing with 10 additions and 10 deletions.
  1. +10 −10 src/redis/core.clj
View
@@ -1,14 +1,14 @@
(ns redis.core
(:refer-clojure :exclude [keys type get set sort])
-
+
;; (:require [clojure.contrib.ns-utils :only (immigrate) :as contrib])
(:use [redis.connection :only (with-connection make-non-pooled-connection-pool)]
[redis.connection-pool :only (make-connection-pool)]
[redis.channel :only (make-direct-channel)]
[redis.vars :only (*pool* *channel*)]
[redis.protocol :only (*return-byte-arrays?* make-multi-bulk-command)]
[redis.defcommand :only (defcommand defcommands)]
-
+
; [redis.commands :only (quit)]
))
@@ -51,7 +51,7 @@
(config [operation param & value])
(info [] :inline crlf-to-hash)
; Connection commands
- (quit [] :inline )
+ (quit [] :inline )
(auth [password])
(ping [] :inline)
; Commands operating on all types
@@ -96,9 +96,9 @@
(lpop [key])
(rpop [key])
(blpop [key timeout])
- ; TODO:
- ; brpop
+ (brpop [key timeout])
(rpoplpush [srckey destkey])
+ (brpoplpush [srckey destkey timeout])
; Set commands
(sadd [key member] int-to-bool)
(srem [key member] int-to-bool)
@@ -156,12 +156,12 @@
"Execute all redis commands in body atomically, ie. sandwiched in a
MULTI/EXEC statement. If an exception is thrown the EXEC command
will be terminated by a DISCARD, no operations will be performed and
- the exception will be rethrown."
+ the exception will be rethrown."
[& body]
- `(do
- (multi)
+ `(do
+ (multi)
(try
- (do
+ (do
~@body
(exec))
(catch Exception e#
@@ -191,7 +191,7 @@
:desc (recur (conj bulks "DESC") args)
(throw (Exception. (str "Error parsing arguments to SORT command: Unknown argument: " type))))))))
-(defcommand sort [key & args]
+(defcommand sort [key & args]
(with-meta
(apply make-multi-bulk-command "SORT" key (parse-sort-args args))
{:redis-keys [key]}))

0 comments on commit bdf369e

Please sign in to comment.