OCaml bindings for kyoto cabinet DBM
  • OCaml 58.2%
  • C 41%
  • Makefile 0.7%
  • Dune 0.1%
Find a file
2019-11-13 10:25:47 +01:00
bin Dune upgrade, fixing warnings which are now fatal 2019-11-13 10:25:47 +01:00
lib Dune upgrade, fixing warnings which are now fatal 2019-11-13 10:25:47 +01:00
test Dune upgrade, fixing warnings which are now fatal 2019-11-13 10:25:47 +01:00
.gitignore Update README once released on OPAM. 2017-09-26 10:14:02 +02:00
dune-project Dune upgrade, fixing warnings which are now fatal 2019-11-13 10:25:47 +01:00
kyotocabinet.descr Typo in file name. 2017-09-21 16:56:29 +02:00
kyotocabinet.opam Dune upgrade, fixing warnings which are now fatal 2019-11-13 10:25:47 +01:00
LICENSE bare minimum documentation 2013-04-18 12:38:36 +02:00
Makefile Dune upgrade, fixing warnings which are now fatal 2019-11-13 10:25:47 +01:00
README.md Update README once released on OPAM. 2017-09-26 10:14:02 +02:00

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