Skip to content

Instantly share code, notes, and snippets.

@weavejester
Forked from anonymous/gist:1522334
Created December 27, 2011 00:18
Show Gist options
  • Save weavejester/1522337 to your computer and use it in GitHub Desktop.
Save weavejester/1522337 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)]
(try
(func)
(finally (.shutdown con 5 TimeUnit/SECONDS)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment