Bitcask is a local key value store. It can be used as an hashtable persisted to disk. It has the following features:
The original implementation is written in Erlang. Since the concepts behind Bitcask are fairly easy, several implementations appeared for various languages.
This implementation allows you to operate on bitcask stores from OCaml while being compatible with the original Erlang implementation.
Make sure that you have ocaml, findlib and bitcask installed. The # character represent the toploop prompt.
Load the toploop and the bitcask package:
Objective Caml version 3.12.0
# #use "topfind";;
# #require "bitcask";;
Bitcask stores can be loaded using the
# let bitcask = Bitcask.load "/path/to/store";;
Stores should be closed with
# Bitcask.close bitcask;;
By default, the
Bitcask.load function will open stores in a read-only mode.
If you plan to modify the store, you should open the store in read-write mode:
# let bitcask = Bitcask.load ~mode:BitcaskOption.Read_write "/path/to/store";;
You could then insert some data using
# Bitcask.put bitcask "key" "value";;
You could test whether a store contains a particular key with
# Bitcask.contains bitcask "key";;
Values can be retrieved with
# let value_option = Bitcask.get bitcask "key";;
This covers the basic usage of bitcask stores. Please refer to the API documentation for further information.
local key value store
bitcask setting management