Liking cljdoc? Tell your friends :D


Predis is a Clojure protocol for Redis, allowing for for multiple client implementations with a common API. Predis provides an in-memory mock client implementation for testing purposes, similar to, and inspired by brigade/mock_redis, as well as a real client that passes operations through to Carmine.


Clojars Project


(require '[predis.core :as redis])

; Using the in-memory mock
(require '[predis.mock :as mock])
(def mock-client (mock/->redis))
(redis/set mock-client "foo" "bar") ; => "OK"
(redis/get mock-client "foo") ; => "bar"

The API is the same for the real Carmine client:

(require '[predis.carmine :as carmine])

; Default config optionally shown
(def carmine-client (carmine/->redis {:pool {} :spec {:host "" :port 6379}}))
(redis/set carmine-client "foo" "bar") ; => "OK"
(redis/get carmine-client "foo") ; => "bar"


API Docs

Note that not every single Redis API operation is supported; consult the protocol documentation for the up-to-date list of supported operations.


Please use the GitHub issues page for questions/comments/suggestions (pull requests welcome!). You can also find me on Twitter.

Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close