summaryrefslogtreecommitdiff
path: root/src/jedis.clj
blob: bc53eda4d0ca887f141f415914d9184d9370a696 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(ns jedis
  (:import org.apache.commons.pool.impl.GenericObjectPool$Config
           redis.clients.jedis.JedisPool)
  (:use config))

(def pool (JedisPool. (:host redis-server) (:port redis-server)))
(.init pool)


(defn with-jedis [fn]
  (let [r (.getResource pool)]
    (try
      (fn r) 
      (finally (.returnResource pool r)))))