Skip to content

Instantly share code, notes, and snippets.

@lukaszkorecki
Created October 9, 2019 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukaszkorecki/0a3233e29b7ce6d8dc24ec68255c769b to your computer and use it in GitHub Desktop.
Save lukaszkorecki/0a3233e29b7ce6d8dc24ec68255c769b to your computer and use it in GitHub Desktop.
(ns omega-red.redis-test
(:require [omega-red.protocol :as proto]
[omega-red.redis]
[com.stuartsierra.component :as component]))
(let [red (componet/start (omega-red.redis/create {:host "127.0.0.1" :port 6379}))]
(println (= 0 (proto/execute red :exists "test.some.key"))) ; true
(println (= "OK" (proto/execute red :set "test.some.key" "foo"))) ; true
(println (= 1 (proto/execute red :exists "test.some.key"))) ; true
(println (= "foo" (proto/execute red :get "test.some.key"))) ; true
(println (= 1 (proto/execute red :del "test.some.key"))) ; true
(component/stop red)
(println (nil? (proto/execute red :get "test.some.key")))) ; true
;; pipeline execution
(println (= [nil "OK" "oh ok" 1]
(proto/execute-pipeline red
[:get "test.some.key.pipe"]
[:set "test.some.key.pipe" "oh ok"]
[:get "test.some.key.pipe"]
[:del "test.some.key.pipe"]))) ; true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment