MCPcopy Create free account
hub / github.com/Luce-Org/lucebox-hub / init

Method init

server/src/server/disk_prefix_cache.cpp:194–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192// ─── Initialization ─────────────────────────────────────────────────────
193
194bool DiskPrefixCache::init() {
195 if (disabled()) return true;
196
197 if (!mkdir_p(config_.cache_dir)) {
198 std::fprintf(stderr, "[disk-cache] failed to create dir: %s\n",
199 config_.cache_dir.c_str());
200 return false;
201 }
202
203 // Try to learn layout from existing files (enables first-request disk hits).
204 try_learn_from_disk();
205
206 std::fprintf(stderr, "[disk-cache] initialized dir=%s budget=%.1f GB layout=%s\n",
207 config_.cache_dir.c_str(),
208 (double)config_.budget_bytes / (1024.0 * 1024.0 * 1024.0),
209 layout_known_ ? hex(layout_id_.data(), 16).c_str() : "pending");
210 return true;
211}
212
213// ─── Layout fingerprint ─────────────────────────────────────────────────
214

Callers 1

HttpServerMethod · 0.45

Calls 3

mkdir_pFunction · 0.85
hexFunction · 0.85
dataMethod · 0.45

Tested by

no test coverage detected