MCPcopy Create free account
hub / github.com/baidu/tera / DeleteFileAndReleaseCache

Method DeleteFileAndReleaseCache

src/leveldb/persistent_cache/persistent_cache_impl.cc:334–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332std::vector<std::string> PersistentCacheImpl::GetAllKeys() { return metadata_.GetAllKeys(); }
333
334Status PersistentCacheImpl::DeleteFileAndReleaseCache(CacheFile* file) {
335 uint64_t file_size;
336 auto status = file->Delete(&file_size);
337 if (!status.ok()) {
338 // unable to delete file
339 LEVELDB_LOG("Remove evicted cache file %lu.rc failed, reason: %s.", file->cacheid(),
340 status.ToString().c_str());
341 return status;
342 }
343
344 assert(file_size <= (uint64_t)size_.Get());
345 size_.Sub(file_size);
346 assert(size_.Get() >= 0);
347 return status;
348}
349
350void PersistentCacheImpl::GarbageCollect() {
351 std::vector<std::unique_ptr<CacheFile>> evictable_files = metadata_.CollectEvictableFiles();

Callers

nothing calls this directly

Calls 6

cacheidMethod · 0.80
SubMethod · 0.80
DeleteMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected