Skip to content

paulosuzart/cloherence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# cloherence

Clojure abstraction with map semantic and DSL on top of Coherence.

## Usage

;; the tests available

(ns cloherence.test.core
  (:use [cloherence core maps] :reload)
  (:use [clojure.test]))

(def anim1 {:name "Nacho" :breed "Bulldog"})
(def anim2 {:name "Taco" :breed "Bulldog"})
(def animals (list anim1 anim2))

(deftest put-in-cache
  (with-cache "animals" 
  	(is 1 (put-val 1 anim1))
	(is anim1 (get-val 1))
	(is nil? (put-seq :name animals))
	(is "Nacho" (:name (get-val "Nacho")))))

(deftest map-semantics
	(cache-map dogs)
	(assoc dogs 1 {:name "nina" :breed "Bulldog"}) 
        (is "nina" (:name (get dogs 1)))
	(update dogs 1 
		(fn [e] {:name (.toUpperCase (:name e))
			 :breed (:breed e)}))
        (is "NINA" (:name (get dogs 1)))
        (inplace-update dogs 1 
		(fn [e arg] {:name (.toLowerCase (:name e))
			 :breed (:breed arg)}) "bull")
	(is "nina" (:name (get dogs 1)))
	(is "bull" (:breed (get dogs 1)))) 

## License

Distributed under the Eclipse Public License, the same as Clojure.

About

clojure map semantics and dsl on top of Coherence

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published