Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2011 00:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/1522334 to your computer and use it in GitHub Desktop.
Save anonymous/1522334 to your computer and use it in GitHub Desktop.
(defn with-mc*
"Manages the memcache connection"
[mchosts func]
(let [^MemcachedClient con (get-connection mchosts)]
(debug "set up new connection")
(. Thread (sleep 1)) ; fix to workaround bug #...
(binding [*db* (assoc *db* :connection con :level 0)]
(func))(.shutdown con 5 TimeUnit/SECONDS))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment