Created
April 1, 2011 10:22
-
-
Save ejackson/897978 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;------------------------------------------------------------------------------ | |
(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