Skip to content

Instantly share code, notes, and snippets.

@avgerin0s
Created July 1, 2014 21:07
Show Gist options
  • Save avgerin0s/1a2f28002078358b0a8e to your computer and use it in GitHub Desktop.
Save avgerin0s/1a2f28002078358b0a8e to your computer and use it in GitHub Desktop.
(ns redis-example.core
(:require [taoensso.carmine :as redis :refer (wcar)]))
(defmacro wcar* [& body] `(redis/wcar server-connection ~@body))
(defn init-redis []
(def server-connection {:pool {:max-active 1}
:spec {
:host "localhost"
:port 6379
:timeout 4000}})
(wcar* (redis/set "foo" "bar")
(redis/set "wat" "woot")))
(defn get-value [k]
(wcar* (redis/get k)))
(defn set-value [k v]
(wcar* (redis/set k v))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment