package kyotocabinet

  1. Overview
  2. Docs
OCaml bindings for Kyoto Cabinet DBM

Install

Dune Dependency

Authors

Maintainers

Sources

0.2.tar.gz
sha256=9cc67fa4a28c68841a9068005ae02ffcc1dfb13e2de245f8b4f9bbc39d53c5a8
md5=c9521f3e2ce86613eb3cf5814d71b4bc

Description

Kyoto Cabinet is a key-value store featuring both B+ tree and hash databases with either in-memory or on-disk persistence.

Published: 11 Feb 2018

README

OCaml bindings for kyoto cabinet DBM

Pre-requisites

License

GNU General Public License.

Install

Using OPAM:

$ opam install kyotocabinet

Or from source:

$ make         # use jbuilder
$ make test
$ make install

Documentation

The API is documented in lib/kyoto.mli

Basic

    #use "topfind";;
    #require "kyotocabinet";;

    (* create a database, here an in-memory tree database. *)
    let db = Kyoto.opendb "+" [Kyoto.OWRITER; Kyoto.OCREATE];;

    (* store records *)
    Kyoto.set db "foo" "hop";;
    Kyoto.set db "bar" "step";;
    Kyoto.set db "baz" "jump";;
    Kyoto.set db "baz2" "jump";;

    (* retrieve records *)
    Kyoto.get db "foo";;
    Kyoto.get db "xoxox";;

    (* update records *)
    Kyoto.set db "bar" "step2";;
    Kyoto.remove db "baz2";;

    (* fold the whole database *)
    Kyoto.fold db (fun n x -> n+1) 0;;

    (* use a cursor to iter over the database *)
    let cursor = Kyoto.cursor_open db;;
    
    Kyoto.cursor_next cursor;;
    Kyoto.cursor_next cursor;;
    Kyoto.cursor_next cursor;;
    Kyoto.cursor_next cursor;;

    Kyoto.cursor_close cursor;;

    (* close the database *)
    Kyoto.close db;;

Dependencies (2)

  1. jbuilder >= "1.0+beta7"
  2. ocaml

Dev Dependencies

None

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.