Skip to content

A disk-backed core.cache implementation based on LMDB

License

Notifications You must be signed in to change notification settings

shriphani/fort-knox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A disk-backed core.cache implementation based on LMDB

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published