Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (ns cacherz-web.db.events
- (:require [mount.core :as mount]
- [konserve.filestore :refer [new-fs-store]]
- [konserve.core :as k]
- [clojure.core.async :as async :refer [<!! go <!]]))
- (def store (go (<!! (new-fs-store "./tmp"))))
- (mount/defstate conn
- :start store
- :stop ())
- (defn get-state [conn state_name default_value]
- (go
- (let [is_state_exists (<!! (k/exists? conn state_name))]
- (if (= true is_state_exists)
- (<!! (k/get-in conn [state_name]))
- default_value))))
- ;(<!! (get-state "test" "wwww")
- (defn assoc-state [conn state_name value]
- (go (<!! (k/assoc-in conn [state_name] value))))
- ;(<!! (assoc-state "test" "123")
- ;Exception in thread "async-dispatch-88" java.lang.NullPointerException
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement