A Clojure library designed to utilise a clojure Ref, and the filesytem as a simple "database".
cljs-time
artifacts are released to Clojars.
If you are using Maven, add the following repository definition to your pom.xml
:
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
With Leiningen:
[com.andrewmcveigh/refdb "0.1.0"]
With Maven:
<dependency>
<groupId>com.andrewmcveigh</groupId>
<artifactId>refdb</artifactId>
<version>0.1.0</version>
</dependency>
Refdb needs to know where it can find it's files. It gets this from
#'refdb.core/*path*
.
Helpers #'refdb.core/with-refdb-path
and #'refdb.core/wrap-refdb
can be
used to set the path in a flexible way.
> (with-refdb-path "/path/to/files"
> (def collection (ref nil))
> (init! collection) ; call in initialisation
> (destroy! collection)
> (save! collection {:key val ...})
> (save! collection assoc-in [0 :key1] {:key val ...})
> (save! collection update-in [0 :key2] inc)
> )
Copyright © 2013 Andrew Mcveigh
Distributed under the Eclipse Public License, the same as Clojure.