@@ -24,75 +24,17 @@ module Cache = struct
2424 (* AST dependency check result cache *)
2525 let ast_dependency_cache = Hashtbl. create 200
2626
27- (* Cache file path - where the cache will be stored on disk *)
28- let cache_file = ref None
29-
30- (* Set the cache file path *)
31- let set_cache_file path = cache_file := Some path
32-
33- (* Get the path of the cache file, creating default if needed *)
34- let get_cache_file () =
35- match ! cache_file with
36- | Some path -> path
37- | None ->
38- let path =
39- Filename. concat (Sys. getcwd () ) " .rescriptdep_cache.marshal"
40- in
41- cache_file := Some path;
42- path
43-
44- (* Initialize the cache from disk if available *)
27+ (* Initialize the cache - simplified to just return false as we don't load from disk anymore *)
4528 let initialize ?(verbose = false ) ?(skip_cache = false ) () =
46- (* Skip initialization if skip_cache is set *)
47- if skip_cache then (
48- if verbose then
49- Printf. printf " Skip cache flag is set, not loading cache\n " ;
50- false )
51- else
52- let path = get_cache_file () in
53- if Sys. file_exists path then (
54- try
55- let ic = open_in_bin path in
56- let stored_cache : (string, cache_entry) Hashtbl.t =
57- Marshal. from_channel ic
58- in
59- close_in ic;
60-
61- (* Transfer to our in-memory cache *)
62- Hashtbl. iter (fun k v -> Hashtbl. replace cache_table k v) stored_cache;
63-
64- if verbose then
65- Printf. printf " Cache loaded from %s with %d entries\n " path
66- (Hashtbl. length cache_table);
67- true
68- with e ->
69- if verbose then
70- Printf. printf " Error loading cache: %s\n " (Printexc. to_string e);
71- false )
72- else (
73- if verbose then Printf. printf " No cache file found at %s\n " path;
74- false )
29+ if verbose then
30+ Printf. printf " File-based caching is disabled, using only memory cache\n " ;
31+ false
7532
76- (* Save the cache to disk *)
33+ (* Save the cache - simplified to just return false as we don't save to disk anymore *)
7734 let save ?(verbose = false ) ?(skip_cache = false ) () =
78- (* Skip saving if skip_cache is set *)
79- if skip_cache then (
80- if verbose then Printf. printf " Skip cache flag is set, not saving cache\n " ;
81- false )
82- else
83- let path = get_cache_file () in
84- try
85- let oc = open_out_bin path in
86- Marshal. to_channel oc cache_table [] ;
87- close_out oc;
88- if verbose then
89- Printf. printf " Cache saved to %s with %d entries\n " path
90- (Hashtbl. length cache_table);
91- true
92- with e ->
93- if verbose then
94- Printf. printf " Error saving cache: %s\n " (Printexc. to_string e);
95- false
35+ if verbose then
36+ Printf. printf " File-based caching is disabled, not saving cache to disk\n " ;
37+ false
9638
9739 (* Add or update an entry in the cache *)
9840 let add ?(skip_cache = false ) path module_info =
@@ -892,9 +834,9 @@ let parse_files_or_dirs ?(verbose = false) ?(skip_cache = false) paths =
892834 if ! benchmark then benchmark_start := Unix. gettimeofday () ;
893835 bench_checkpoint " Parser started" ;
894836
895- (* Initialize the cache system *)
837+ (* Initialize the memory cache system - call is kept for compatibility *)
896838 let _ = Cache. initialize ~verbose ~skip_cache () in
897- bench_checkpoint " Cache initialization completed" ;
839+ bench_checkpoint " Memory cache setup completed" ;
898840
899841 (* Collect all cmt files *)
900842 let collect_cmt_files paths =
@@ -1021,10 +963,8 @@ let parse_files_or_dirs ?(verbose = false) ?(skip_cache = false) paths =
1021963 results)
1022964 in
1023965
1024- (* After all files are processed, save the cache *)
1025- let _ = bench_checkpoint " Processing completed" in
1026- let _ = Cache. save ~verbose ~skip_cache () in
1027- bench_checkpoint " Cache saved" ;
966+ (* After all files are processed, no need to save cache to disk anymore *)
967+ bench_checkpoint " Processing completed" ;
1028968
1029969 if ! benchmark && verbose then (
1030970 Printf. eprintf " \n [PARSER-BENCH] Summary:\n " ;
@@ -1037,8 +977,5 @@ let parse_files_or_dirs ?(verbose = false) ?(skip_cache = false) paths =
1037977(* Clear the module info cache *)
1038978let clear_cache () = Cache. clear ()
1039979
1040- (* Set the cache file path *)
1041- let set_cache_file path = Cache. set_cache_file path
1042-
1043980(* Set the skip cache flag - now just a stub since we pass skip_cache directly *)
1044981let set_skip_cache _flag = ()
0 commit comments