MCPcopy Create free account
hub / github.com/facebook/CacheLib / shutdown

Method shutdown

cachelib/interface/components/RAMCacheComponent.cpp:464–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464UnitResult RAMCacheComponent::shutdown() {
465 if (persist_) {
466 switch (cache_->shutDown()) {
467 case LruAllocator::ShutDownStatus::kSuccess: // fall-through
468 case LruAllocator::ShutDownStatus::kSavedOnlyDRAM:
469 break;
470 case LruAllocator::ShutDownStatus::kSavedOnlyNvmCache: // fall-through
471 case LruAllocator::ShutDownStatus::kFailed: // fall-through
472 default:
473 return makeError(Error::Code::SHUTDOWN_FAILED,
474 "failed to persist RAM cache state");
475 }
476 } else {
477 // shutDown() internally calls stopWorkers() but doesn't check the return
478 // value so we won't either
479 cache_->stopWorkers();
480 }
481 return folly::unit;
482}
483
484CacheComponentStats RAMCacheComponent::getStats() const noexcept {
485 CacheComponentStats stats(*stats_);

Callers 3

TearDownMethod · 0.45
TearDownMethod · 0.45
CO_TYPED_TESTFunction · 0.45

Calls 2

stopWorkersMethod · 0.80
shutDownMethod · 0.45

Tested by 3

TearDownMethod · 0.36
TearDownMethod · 0.36
CO_TYPED_TESTFunction · 0.36