Skip to content

A set of higher-level Clojure abstractions built on top of HazelCast

Notifications You must be signed in to change notification settings

AlexBaranosky/witch-hazel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Set Of Higher-Level Abstractions On Top of HazelCast For Clojure

;; Not deployed to Clojars yet.....
[org.clojars.alexbaranosky/witch-hazel "0.0.1"]

Hazel Refs

hazel-ref behaves like clojure.core/ref, but using Hazelcast as a distributed mutable state.

(def hazelcast (make-hazelcast))

(def r1 (hazel-ref hazelcast "my-ref" 1))
;; @r1 => 1

(def r2 (hazel-ref hazelcast "my-ref" 2))
;; @r1 => 2
;; @r2 => 2

(do-transaction hazelcast
                (halter r1 + 3 4))
;; @r1 => 9
;; @r2 => 9

(do-transaction hazelcast
                (hazel-ref-set r2 88))
;; @r1 => 88
;; @r2 => 88

do-transaction can roll-back

(def  r1 (hazel-ref hazelcast "my-ref1" 1))
;; @r1 => 1

(def r2 (hazel-ref hazelcast "my-ref2" 2))
;; @r2 => 2

(do-transaction hazelcast
                (halter r1 + 3 4)
                (throw (Exception. "note, no changes to r1 or r2"))
                (halter r2 +99))
;; @r1 => 1
;; @r2 => 2

Hazel Caches

Hazel Memoization

About

A set of higher-level Clojure abstractions built on top of HazelCast

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published