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

Method init_full_cache

server/src/server/prefix_cache.cpp:356–378  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

354 // selected through the explicit eviction path or through a round-robin
355 // hole left by an earlier aborted reservation.
356 for (int i = (int)entries_.size() - 1; i >= 0; --i) {
357 if (entries_[(size_t)i].slot == slot) {
358 entries_.erase(entries_.begin() + i);
359 entries_size_count_.fetch_sub(1, std::memory_order_relaxed);
360 }
361 }
362 has_pending_evict_ = false;
363}
364
365void PrefixCache::cancel_inline_snap(int slot) {
366 if (disabled_) return;
367 if (has_pending_evict_) {
368 const int idx = find_entry(pending_evict_key_);
369 if (idx >= 0 && entries_[idx].slot != slot) return;
370 }
371 has_pending_evict_ = false;
372}
373
374void PrefixCache::mark_all_cleared() {
375 if (disabled_) return;
376 int n = (int)entries_.size();
377 entries_.clear();
378 entries_size_count_.store(0, std::memory_order_relaxed);
379 next_slot_ = 0;
380 has_pending_evict_ = false;
381 std::fprintf(stderr, "[pc] all-cleared — dropped %d LRU entries\n", n);

Callers 1

HttpServerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected