package kyotocabinet

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

Install

Dune Dependency

Authors

Maintainers

Sources

1.0.tar.gz
sha256=03e1362a2c33385d7faa16f4f93cfb2bd90ddc0195832c261b6ce0552e45ad25
md5=f075dd4386c9fbfb6abdccfad75f9751

README.md.html

OCaml bindings for kyoto cabinet DBM

Pre-requisites

License

GNU General Public License.

Install

$ 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;;
OCaml

Innovation. Community. Security.