Revision 5d3bda611337718ff32577282e3d768c95917bda authored by vbot on 27 February 2020, 12:21:45 UTC, committed by vbot on 09 March 2020, 17:33:55 UTC
1 parent a1ec093
Raw File
pack_dict.ml
(* Permission to use, copy, modify, and/or distribute this software for any
   purpose with or without fee is hereby granted, provided that the above
   copyright notice and this permission notice appear in all copies.

   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
   ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
   ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *)

include Dict.Make (IO.Unix)

(* Add IO caching around Dict.v *)
let (`Staged v) =
  let v_no_cache ~fresh ~readonly = v ~fresh ~readonly in
  IO.with_cache ~clear ~valid
    ~v:(fun capacity -> v_no_cache ~capacity)
    "store.dict"

let v ?fresh ?readonly ?(capacity = 100_000) root =
  v capacity ?fresh ?readonly root
back to top