Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed redis-clojure source

  • Loading branch information...
commit 0b8ffd637f9660eb5e9062d6a95bcad42e2e62cb 1 parent dbb6be9
Jeyan Oorjitham authored
4 project.clj
View
@@ -7,10 +7,8 @@
[org.clojure/clojure-contrib "1.2.0"]
[compojure "0.6.4"]
[ring/ring-jetty-adapter "0.3.10"]
- ;Using code straight from github instead
- ;[org.clojars.tavisrudd/redis-clojure "1.3.0"]
[enlive "1.0.0"]
- [commons-pool/commons-pool "1.5.5"]
+ [org.clojars.tavisrudd/redis-clojure "1.3.1-SNAPSHOT"]
]
:dev-dependencies [[lein-ring "0.4.5"]]
:ring {:handler testify.core/app}
25 src/redis/channel.clj
View
@@ -1,25 +0,0 @@
-(ns redis.channel
- (:use [redis.protocol :only (read-reply write-to-buffer write-to-stream)]
- [redis.connection :only (RedisConnection input-stream output-stream)])
- (:import [java.io ByteArrayOutputStream]))
-
-;;; Protocols
-(defprotocol RedisChannel
- "A RedisChannel supports sending commands"
- (send! [channel #^redis.protocol.RedisCommand command]))
-
-;;; Direct channel
-(defrecord DirectChannel [#^redis.connection.RedisConnection connection]
- RedisChannel
- (send! [this command]
- (let [buf (ByteArrayOutputStream.)
- out (output-stream connection)
- in (input-stream connection)]
- (write-to-buffer command buf)
- (write-to-stream buf out)
- (read-reply in))))
-
-(defn make-direct-channel [connection]
- (DirectChannel. connection))
-
-
88 src/redis/connection.clj
View
@@ -1,88 +0,0 @@
-(ns redis.connection
- (:use [redis.protocol :only (write-to-buffer write-to-stream make-inline-command)])
-
- (:import [java.net Socket]
- [java.io BufferedInputStream ByteArrayOutputStream]))
-
-;;; Protocols
-
-(defprotocol RedisConnectionPool
- (get-connection [pool connection-spec])
- (release-connection [pool connection]
- [pool connection exception]))
-
-(defprotocol RedisConnection
- (get-server-spec [connection])
- (connected? [connection])
- (close [connection])
- (input-stream [connection])
- (output-stream [connection]))
-
-
-;;; Macros
-
-(defmacro with-connection [name pool server-spec & body]
- `(let [~name (get-connection ~pool ~server-spec)]
- (try
- ~@body
- (catch Exception e#
- (throw e#))
- (finally
- (release-connection ~pool ~name)))))
-
-
-;;; Implementations
-(defn send-command-and-read-reply
- [connection command]
- (let [buf (ByteArrayOutputStream.)
- in (input-stream connection)
- out (output-stream connection)]
- (write-to-buffer command buf)
- (write-to-stream buf out)
- (redis.protocol/read-reply in)))
-
-(defn connection-alive? [connection]
- "Determines whether the connection is still alive"
- (let [ping (make-inline-command "PING")
- resp (send-command-and-read-reply connection ping)]
- (= resp "PONG")))
-
-(defrecord Connection [#^Socket socket server-spec]
- RedisConnection
- (get-server-spec [this] server-spec)
- (connected? [this] (connection-alive? this))
- (close [this] (.close socket))
- (input-stream [this] (BufferedInputStream. (.getInputStream socket)))
- (output-stream [this] (.getOutputStream socket)))
-
-(def default-connection-spec {:host "127.0.0.1"
- :port 6379
- :timeout 5000
- :password nil
- :db 0})
-;TODO: maybe change this on the connection-alive? side instead?
-(defn make-connection [server-spec]
- (let [spec (merge default-connection-spec server-spec)
- {:keys [host port timeout password]} spec
- socket (Socket. #^String host #^Integer port)]
- (doto socket
- (.setTcpNoDelay true)
- (.setSoTimeout timeout))
- (let [connection (Connection. socket server-spec)]
- (if (nil? password)
- connection
- (do (send-command-and-read-reply connection (make-inline-command (str "auth " password)))
- connection)))))
-
-(defrecord NonPooledConnectionPool []
- RedisConnectionPool
- (get-connection [this connection-spec]
- (make-connection connection-spec))
- (release-connection [this connection]
- (close connection))
- (release-connection [this connection exception]
- (close connection)))
-
-(defn make-non-pooled-connection-pool []
- (NonPooledConnectionPool.))
-
69 src/redis/connection_pool.clj
View
@@ -1,69 +0,0 @@
-(ns redis.connection-pool
- (:use [redis.connection :only (RedisConnectionPool make-connection connected? close get-server-spec)])
- (:import [org.apache.commons.pool.impl GenericKeyedObjectPool]
- [org.apache.commons.pool KeyedPoolableObjectFactory]))
-
-;; Connection pooling implemented using Apache commons-pool.
-
-(defrecord ConnectionPool [#^GenericKeyedObjectPool object-pool]
- RedisConnectionPool
- (get-connection [this server-spec]
- (.borrowObject object-pool server-spec))
- (release-connection [this connection]
- (let [server-spec (get-server-spec connection)]
- (.returnObject object-pool server-spec connection)))
- (release-connection [this connection exception]
- (let [server-spec (get-server-spec connection)]
- (.invalidateObject object-pool server-spec connection))))
-
-(defn- make-connection-factory []
- (reify KeyedPoolableObjectFactory
- (makeObject [this key] (make-connection key))
- (activateObject [this key connection])
- (validateObject [this key connection]
- (connected? connection))
- (passivateObject [this key connection])
- (destroyObject [this key connection] (close connection))))
-
-(defn- set-pool-option [#^GenericKeyedObjectPool pool [opt v]]
- (case opt
- :max-active (.setMaxActive pool v)
- :max-total (.setMaxTotal pool v)
- :max-idle (.setMaxIdle pool v)
- :when-exhausted-action (.setWhenExhaustedAction pool v)
- :test-on-borrow (.setTestOnBorrow pool v)
- :test-on-return (.setTestOnReturn pool v)
- :time-between-eviction-runs-ms (.setTimeBetweenEvictionRunsMillis pool v)
- :min-evictable-idle-time-ms (.setMinEvictableIdleTimeMillis pool v)
- :test-while-idle (.setTestWhileIdle pool v)
- :min-idle (.setMinIdle pool v)
- :lifo (.setLifo pool v))
- pool)
-
-(defn- make-generic-keyed-object-pool [options]
- (let [factory (make-connection-factory)
- pool (GenericKeyedObjectPool. factory)]
- (reduce set-pool-option pool options)))
-
-(defn make-connection-pool
- "Create a connection pool. Available options are:
-
- :max-active
- :max-total
- :max-idle
- :when-exhausted-action
- :test-on-borrow
- :test-on-return
- :time-between-eviction-runs-ms
- :min-evictable-idle-time-ms
- :test-while-idle
- :min-idle
- :lifo
-
- see
- http://commons.apache.org/pool/apidocs/org/apache/commons/pool/impl/GenericKeyedObjectPool.html
- for option documentation
- "
- [& options]
- (ConnectionPool. (make-generic-keyed-object-pool (apply hash-map options))))
-
193 src/redis/core.clj
View
@@ -1,193 +0,0 @@
-(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)]
- ))
-
-
-(defmacro with-server
- "Evaluates body in the context of a connection to Redis server
- specified by server-spec.
-
- server-spec is a map with any of the following keys:
- :host (\"127.0.0.1\")
- :port (6379)
- :db (0)
- :timeout (5000)
- :password (nil)"
- ([server-spec & body]
- `(with-connection connection# *pool* ~server-spec
- (binding [redis.vars/*channel* (make-direct-channel connection#)]
- ~@body))))
-
-(defmacro as-bytes
- "Wrap a Redis command in this macro to make it return
- byte array(s) instead of string(s)."
- [& body]
- `(binding [*return-byte-arrays?* true]
- ~@body))
-
-
-;;; Command definitions
-
-;; Utility conversion functions
-(defn- int-to-bool [n] (if (integer? n) (< 0 n) n))
-(defn- string-to-keyword [s] (keyword s))
-(defn- string-to-double [s] (when s (Double/parseDouble s)))
-(defn- seq-to-set [seq] (when seq (clojure.core/set seq)))
-(defn- seq-to-map [seq] (when seq (apply hash-map seq)))
-
-(defcommands
- ; Connection handling
- (quit [] :inline )
- (auth [password])
- (ping [] :inline)
- ; Commands operating on all types
- (exists [key] int-to-bool)
- (del [key & keys])
- (type [key] string-to-keyword)
- (keys [pattern])
- (randomkey [] :inline)
- (rename [oldkey newkey])
- (renamenx [oldkey newkey] int-to-bool)
- (dbsize [] :inline)
- (expire [key seconds] int-to-bool)
- (ttl [key])
- (select [db])
- (move [key dbindex])
- (flushdb [] :inline)
- (flushall [] :inline)
- ; String commands
- (get [key])
- (set [key val])
- (getset [key val])
- (mget [key & keys])
- (setnx [key val] int-to-bool)
- (setex [key ttl val])
- (mset [key val & keyvals])
- (msetnx [key val & keyvals] int-to-bool)
- (incr [key])
- (incrby [key int])
- (decr [key])
- (decrby [key int])
- (append [key val])
- (substr [key start end])
- ; List commands
- (rpush [key value])
- (lpush [key value])
- (llen [key])
- (lrange [key start end])
- (ltrim [key start end])
- (lindex [key index])
- (lset [key index value])
- (lrem [key count value])
- (lpop [key])
- (rpop [key])
- (blpop [key timeout])
- ; TODO:
- ; brpop
- (rpoplpush [srckey destkey])
- ; Set commands
- (sadd [key member] int-to-bool)
- (srem [key member] int-to-bool)
- (spop [key])
- (smove [srckey destkey member] int-to-bool)
- (scard [key])
- (sismember [key member] int-to-bool)
- (sinter [key & keys] seq-to-set)
- (sinterstore [destkey key & keys])
- (sunion [key & keys] seq-to-set)
- (sunionstore [destkey key & keys])
- (sdiff [key & keys] seq-to-set)
- (sdiffstore [destkey key & keys])
- (smembers [key] seq-to-set)
- (srandmember [key])
- ; Sorted Set commands
- (zadd [key score member] int-to-bool)
- (zrem [key member] int-to-bool)
- (zincrby [key increment member] string-to-double)
- (zrank [key member])
- (zrevrank [key member])
- (zrange [key start end & options])
- (zrevrange [key start end & options])
- (zrangebyscore [key start end & options])
- (zrevrangebyscore [key start end & options])
- (zremrangebyrank [key start end])
- (zremrangebyscore [key start end])
- (zcard [key])
- (zcount [key min max])
- (zscore [key member] string-to-double)
- (zunionstore [destkey numkeys key & other-keys-and-options])
- (zinterstore [destkey numkeys key & other-keys-and-options])
- ; Hash commands
- (hset [key field val])
- (hget [key field])
- (hsetnx [key field val] int-to-bool)
- (hmset [key field val & fieldvals])
- (hmget [key field & fields])
- (hincrby [key field val])
- (hexists [key field] int-to-bool)
- (hdel [key field] int-to-bool)
- (hlen [key])
- (hkeys [key])
- (hvals [key])
- (hgetall [key] seq-to-map)
- ; multi/exec/discard/watch/unwatch
- (multi [] :inline)
- (exec [] :inline)
- (discard [] :inline)
- (watch [key & keys])
- (unwatch [] :inline))
-
-;; atomically macro
-(defmacro atomically
- "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."
- [& body]
- `(do
- (multi)
- (try
- (do
- ~@body
- (exec))
- (catch Exception e#
- (discard)
- (throw e#)))))
-
-;; Sort command
-
-(defn- parse-sort-args [args]
- (loop [bulks []
- args args]
- (if (empty? args)
- bulks
- (let [[type & args] args]
- ;; TODO: Check for nil!
- (condp = type
- :by (let [[pattern & rest] args]
- (recur (conj bulks "BY" pattern) rest))
- :limit (let [[start end & rest] args]
- (recur (conj bulks "LIMIT" start end) rest))
- :get (let [[pattern & rest] args]
- (recur (conj bulks "GET" pattern) rest))
- :store (let [[key & rest] args]
- (recur (conj bulks "STORE" key) rest))
- :alpha (recur (conj bulks "ALPHA") args)
- :asc (recur (conj bulks "ASC") args)
- :desc (recur (conj bulks "DESC") args)
- (throw (Exception. (str "Error parsing arguments to SORT command: Unknown argument: " type))))))))
-
-(defcommand sort [key & args]
- (with-meta
- (apply make-multi-bulk-command "SORT" key (parse-sort-args args))
- {:redis-keys [key]}))
89 src/redis/defcommand.clj
View
@@ -1,89 +0,0 @@
-(ns redis.defcommand
- (:use [clojure.string :only (upper-case)])
- (:use [redis.vars :only (*channel*)]
- [redis.protocol :only (make-inline-command make-multi-bulk-command)]
- [redis.channel :only (send!)]))
-
-;;;; Command definition macros
-
-(defn get-key-fns [args]
- "Given a params vector, return a list of functions that knows how
- to extract keys from the given args.
-
- This implementation detects keys in three ways:
- - The argument is named key
- - The argument is a vector named keys
- - The argument is a vector named keyvals"
- (loop [key-fns []
- [first & rest] args]
- (if (nil? first)
- key-fns
- (condp = first
- 'key (recur (conj key-fns identity) rest)
- 'keys (recur (conj key-fns identity) rest)
- 'keyvals (recur (conj key-fns #(take-nth 2 %)) rest)
- (recur (conj key-fns nil) rest)))))
-
-(defn extract-keys [key-fns args]
- (vec (flatten (filter #(not (nil? %))
- (map #(when (not (nil? %1))
- (%1 %2)) key-fns args)))))
-
-(def ^:dynamic
- *default-opts* {:type :multi-bulk
- :reply-fn identity
- :key-fn get-key-fns
- :redis-shard :one})
-
-(def ^:dynamic
- *command-types* {:inline make-inline-command
- :multi-bulk make-multi-bulk-command})
-
-
-(defn parse-opts+body [opts+body]
- (loop [opts *default-opts*
- args opts+body]
- (let [[v & rest] args]
- (cond
- (nil? v) [opts nil]
- (list? v) [opts v]
- (or (var? v)
- (symbol? v)
- (fn? v)) (recur (assoc opts :reply-fn v) rest)
- (keyword? v) (condp = v
- :inline (recur (assoc opts :type v) rest)
- :multi-bulk (recur (assoc opts :type v) rest)
- :all (recur (assoc opts :redis-shard v) rest)
- :one (recur (assoc opts :redis-shard v) rest))))))
-
-(defn flatten-args [args]
- (let [[args rest] (split-with #(not= % '&) args)]
- [args (last rest)]))
-
-(defmacro defcommand
- ([name args & opts+body]
- (let [[opts body] (parse-opts+body opts+body)
- {:keys [type reply-fn key-fn redis-shard]} opts
- command-name (upper-case name)
- command-fn (type *command-types*)
- [command-args command-rest-args] (flatten-args args)
- args-without-and (vec (filter #(not= '& %) args))
- key-fns (key-fn args-without-and)]
- (if body
- `(defn ~name ~args
- (let [command# ~body]
- (send! *channel* command#)))
- `(defn ~name ~args
- (let [command# (apply ~command-fn
- ~command-name
- ~@command-args
- ~command-rest-args)
- keys# (extract-keys ~key-fns ~args-without-and)]
- (~reply-fn (send! *channel*
- (with-meta command#
- {:redis-keys (vec keys#)
- :redis-shard ~redis-shard })))))))))
-
-(defmacro defcommands [& command-defs]
- `(do ~@(map (fn [command-def]
- `(defcommand ~@command-def)) command-defs)))
51 src/redis/pipeline.clj
View
@@ -1,51 +0,0 @@
-(ns redis.pipeline
- (:refer-clojure :exclude [send read read-line])
- (:use [redis.vars :only (*channel*)]
- [redis.channel :only (RedisChannel)]
- [redis.connection :only (input-stream output-stream)]
- [redis.protocol :only (write-to-buffer write-to-stream read-reply)])
- (:import [java.io ByteArrayOutputStream]
- [java.net SocketTimeoutException]))
-
-
-(defrecord PipelinedChannel [channel commands]
- RedisChannel
- (send! [this command]
- (swap! commands conj command)
- nil))
-
-(defn make-pipelined-channel [channel]
- (PipelinedChannel. channel (atom [])))
-
-(defn send-pipelined-commands [pipeline]
- (let [buf (ByteArrayOutputStream.)
- channel (:channel pipeline)
- connection (:connection channel)
- commands @(:commands pipeline)
- ncommands (count commands)
- out (output-stream connection)
- in (input-stream connection)]
- (dorun
- (map #(write-to-buffer % buf) commands))
- (write-to-stream buf out)
- (let [reply (transient [])]
- (dotimes [i ncommands]
- (try
- (conj! reply (read-reply in))
- (catch SocketTimeoutException e
- (throw e))
- (catch Exception e
- (conj! reply e))))
- (persistent! reply))))
-
-(defmacro pipeline
- "Evaluate body, pipelining any Redis commands. Commands in body will
- return nil, and pipeline will return a vector of replies.
-
- Any exceptions will be caught and returned in the reply vector."
- [& body]
- `(binding [redis.vars/*channel* (make-pipelined-channel redis.vars/*channel*)]
- ~@body
- (send-pipelined-commands *channel*)))
-
-
211 src/redis/protocol.clj
View
@@ -1,211 +0,0 @@
-(ns redis.protocol
- (:refer-clojure :exclude [read read-line send])
- (:import [java.net Socket]
- [java.nio ByteBuffer]
- [java.io InputStream
- OutputStream
- BufferedInputStream
- BufferedOutputStream
- ByteArrayOutputStream
- ByteArrayInputStream]))
-
-;;;
-;;; Protocols
-;;;
-(defprotocol RedisInputStream
- (#^String read [stream count])
- (read-crlf [stream])
- (#^String read-line [stream]))
-
-;;;
-;;; Reply parsing
-;;;
-
-(def #^String ^:dynamic *string-charset* "UTF-8")
-
-(def #^Boolean ^:dynamic *return-byte-arrays?* false)
-
-(def CR (byte 0x0d))
-(def LF (byte 0x0a))
-(def CRLF (byte-array 2 [CR LF]))
-(defn- CR? [b] (= b CR))
-(defn- LF? [b] (= b LF))
-(defn- to-ascii [value] (.getBytes (str value) "ASCII"))
-
-
-(defn- read-expected-byte [#^InputStream stream expected]
- (let [actual (.read stream)
- expected (int expected)]
- (cond
- (= actual expected) actual
- (= actual -1) (throw (Exception. "End of stream reached"))
- true (throw (Exception. (format "Expected byte: 0x%1$x, read 0x%2$x" expected actual))))))
-
-
-(extend-type BufferedInputStream
- RedisInputStream
- (read [this count]
- (let [buf (byte-array count)]
- (loop [start 0]
- (let [nread (.read this buf start (- count start))]
- (when (= -1 nread)
- (throw (Exception. (str "End of stream reached"))))
- (if (= (+ nread start) count)
- (if *return-byte-arrays?*
- buf
- (String. buf *string-charset*))
- (recur (+ nread start)))))))
-
- (read-crlf [this]
- (read-expected-byte this CR)
- (read-expected-byte this LF))
-
- (read-line [this]
- (let [buf (ByteArrayOutputStream.)]
- (loop [byte (.read this)]
- (when (= byte -1)
- (throw (Exception. "End of stream reached")))
- (if (CR? byte)
- (let [next (.read this)]
- (if (LF? next)
- (String. (.toByteArray buf) *string-charset*)
- (throw (Exception. "Read CR not followed by LF"))))
- (do
- (.write buf byte)
- (recur (.read this))))))))
-
-
-;;
-;; Replies
-;;
-(declare read-reply)
-
-(defn- parse-int [string] (Integer/parseInt string))
-
-(defn- read-error-reply [channel]
- (let [message (read-line channel)]
- (throw (Exception. message))))
-
-(defn- read-single-line-reply [channel]
- (read-line channel))
-
-(defn- read-bulk-reply [channel]
- (let [line (read-line channel)
- len (parse-int line)]
- (if (neg? len)
- nil
- (let [bulk (read channel len)]
- (read-crlf channel)
- bulk))))
-
-(defn- read-multi-bulk-reply [channel]
- (let [line (read-line channel)
- nbulks (parse-int line)]
- (if (< nbulks 0)
- nil
- (loop [i nbulks
- bulks []]
- (if (zero? i)
- bulks
- (recur (dec i) (conj bulks (read-reply channel))))))))
-
-(defn- read-integer-reply [channel]
- (let [number (read-line channel)]
- (parse-int number)))
-
-(defn read-reply [channel]
- (let [type (binding [*return-byte-arrays?* false] (read channel 1))]
- (case type
- "-" (read-error-reply channel)
- "+" (read-single-line-reply channel)
- "$" (read-bulk-reply channel)
- "*" (read-multi-bulk-reply channel)
- ":" (read-integer-reply channel)
- (throw (Exception. (format "Unknown reply type: %1$c" type))))))
-
-;;
-;; Commands
-;;
-(defprotocol RedisBuffer
- "A RedisBuffer supports putting bytes in, and writing them out to a
-Stream"
- (put-byte [buf byte])
- (put-bytes [buf #^bytes bytes])
- (write-to-stream [buf #^Stream stream]))
-
-(defprotocol RedisCommand
- "A RedisCommand knows how to write itself to a RedisBuffer"
- (write-to-buffer [command buf]))
-
-;; Extend ByteArrayOutputStream to support the RedisBuffer protocol
-(extend-type ByteArrayOutputStream
- RedisBuffer
- (put-byte [this #^Integer byte] (.write this byte))
- (put-bytes [this #^bytes bytes] (.write this bytes 0 (alength bytes)))
- (write-to-stream [this stream] (.writeTo this stream)))
-
-;; Inline command
-(defrecord InlineCommand [#^String name]
- RedisCommand
- (write-to-buffer [this buf]
- (let [bytes (to-ascii name)]
- (put-bytes buf bytes)
- (put-bytes buf CRLF)))
-
- Object
- (toString [this]
- (let [buf (ByteArrayOutputStream.)]
- (write-to-buffer this buf)
- (str buf))))
-
-(defn make-inline-command [name]
- (InlineCommand. name))
-
-;; Multi bulk command
-(def bulk-count-marker (int \*))
-(def bulk-length-marker (int \$))
-
-(defn- write-bulk-header [buf nbulks]
- (put-byte buf bulk-count-marker)
- (put-bytes buf (to-ascii nbulks))
- (put-bytes buf CRLF))
-
-(let [byte-array-class (class (into-array Byte/TYPE []))]
- (defn- bytes? [obj]
- (= (class obj) byte-array-class)))
-
-(defn- write-bulk [buf bulk]
- (let [#^bytes data (cond (bytes? bulk) bulk
- ;; @@TR I think the following might be
- ;; wrong, but the original definitely was
- ;; as getBytes is not a method on
- ;; ByteBuffer
- (= (class bulk) java.nio.ByteBuffer) (.get #^ByteBuffer bulk)
- true (.getBytes (str bulk) *string-charset*))
- len (alength data)]
- (put-byte buf bulk-length-marker)
- (put-bytes buf (to-ascii len))
- (put-bytes buf CRLF)
- (put-bytes buf data)
- (put-bytes buf CRLF)))
-
-(defrecord MultiBulkCommand [bulks]
- RedisCommand
- (write-to-buffer [this buf]
- (let [nbulks (count bulks)]
- (write-bulk-header buf nbulks)
- (dorun
- (map #(write-bulk buf %) bulks))))
-
- Object
- (toString [this]
- (let [buf (ByteArrayOutputStream.)]
- (write-to-buffer this buf)
- (str buf))))
-
-(defn make-multi-bulk-command [& args]
- (when (empty? args)
- (throw (IllegalArgumentException.
- "At least one argument is required for multi bulk commands")))
- (MultiBulkCommand. args))
-
14 src/redis/vars.clj
View
@@ -1,14 +0,0 @@
-(ns redis.vars
- (:use [redis.connection-pool :only (make-connection-pool)]))
-;;;; Vars
-
-(def ^:dynamic
- #^{:doc "Bound to an implementation of RedisConnectionPool"}
- *pool*
- (make-connection-pool :lifo false
- :test-on-borrow true))
-
-(def ^:dynamic #^{:doc "Bound to an implementation of RedisChannel"
- }
- *channel* nil)
-
1  src/testify/remain.clj
View
@@ -2,6 +2,7 @@
(:require [redis.core :as redis])
(:require [clojure.string :as string])
(:require [clojure.contrib.str-utils :as str-utils])
+ (:require [redis.core :as redis])
)
(defn redis-creds []
Please sign in to comment.
Something went wrong with that request. Please try again.