val mutable db = open_dbm ()
- initializer Gc.finalise Dbm.close db (* close db on GC *)
+ (*initializer Gc.finalise Dbm.close db (* close db on GC *)*)
method add key value =
self#doWriter (lazy (
method clear =
self#doWriter (lazy (
Dbm.close db;
- Sys.remove (dbname ^ ".dir");
- Sys.remove (dbname ^ ".pag");
+ List.iter
+ (fun ext ->
+ let file = dbname ^ ext in
+ if Sys.file_exists file then Sys.remove file)
+ [".dir"; ".pag"; ".db"];
db <- open_dbm ()
))
+ method close =
+ self#doWriter (lazy (
+ Dbm.close db
+ ))
+
end