Skip to content

Instantly share code, notes, and snippets.

@ejackson ejackson/redis.clj
Created Apr 1, 2011

Embed
What would you like to do?
;;------------------------------------------------------------------------------
(declare *connection*)
(defmacro with-redis
([host func]
`(binding [*connection* (Jedis. ~host)]
(try
(~@func)
(finally
(.disconnect *connection*))))))
(defmacro redis* [host name & args]
`(with-redis
~host
(. *connection* ~name ~@args)))
(defmacro create-redis [host]
`(defmacro redis [n# & args#]
`(redis* ~~host ~n# ~@args#)))
(redis keys "*")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.