A disk-backed core.cache implementation based on LMDB
Clojure
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
src/fort_knox
test/fort_knox
.gitignore
CHANGELOG.md
LICENSE
README.md
project.clj

README.md

fort-knox

An implementation of core.cache that saves entries to disk.

You get a chance to use LevelDB (default) or LMDB.

Circle CI

Clojars Project

DISCLAIMER typical core.cache implementations use persistent and associative data structures. Since a disk-backed key-value store doesn't have any such concept, this implementation might not conform to expected behavior.

Usage

Import this implementation:

user> (use 'fort-knox.core :reload-all)
nil

Create a cache (LevelDB by default):

user> (def cache (make-cache "/tmp"))
#'user/cache

If you want to use LMDB:

user> (def cache (make-cache "/tmp" :type :lmdb))
#'user/cache

Everything else is from core.cache. For example:

user> (cache/has? cache "foo")
false
user> (cache/miss cache "foo" "bar")
{:env #object[org.fusesource.lmdbjni.Env 0x6e09d885 "org.fusesource.lmdbjni.Env@6e09d885"], :db #object[org.fusesource.lmdbjni.Database 0x65807b47 "org.fusesource.lmdbjni.Database@65807b47"]}
user> (cache/has? cache "foo")
true

License

Copyright © 2016 Shriphani Palakodety

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.