Introduction

Bitcask is a local key value store. It can be used as a persistent hashtable that can hold large amount of data. The original implementation written in Erlang is used as a backend for the Riak distributed database.

This implementation allows you to operate on bitcask stores from OCaml while being compatible with the original implementation.

 

Features

  • keys are held in memory
  • records are stored on disk in log-structured files
  • latency is predictable
 

It's free

OCaml Bitcask is an open-source software distributed under the MIT license.
 

30-second tutorial

Create a file named bitcask_test.ml with the following content:
(* open a store located in $PWD/test-store/ in read-write mode *)
let bitcask = Bitcask.load ~mode:BitcaskOption.Read_write "test-store" in
(* insert some data *)
Bitcask.put bitcask "key" "value";
(* fetch some data *)
print_endline (Bitcask.get_exn bitcask "key");
(* eventually close the store *)
Bitcask.close bitcask
You can then compile this file with:
 ocamlfind ocamlc -package bitcask -linkpkg -o bitcask_test bitcask_test.ml 
 

Getting bitcask

The current release (version 0.2) can be downloaded here. Please refer to the readme.txt file included in the archive for installation instructions.
Previous releases can be obtained via the project filelist.
Source code can be retrieved using git:
  • on gitorious:
    git clone http://git.gitorious.org/ocaml-bitcask/ocaml-bitcask.git
  • on the forge:
    git clone https://forge.ocamlcore.org/anonscm/git/bitcask/bitcask.git