xinyiZzz commented on code in PR #28940: URL: https://github.com/apache/doris/pull/28940#discussion_r1437507785
########## be/src/olap/lru_cache.cpp: ########## @@ -667,4 +669,43 @@ void ShardedLRUCache::update_cache_metrics() const { total_lookup_count == 0 ? 0 : ((double)total_hit_count / total_lookup_count)); } +Cache::Handle* DummyLRUCache::insert(const CacheKey& key, void* value, size_t charge, + void (*deleter)(const CacheKey& key, void* value), + CachePriority priority, size_t bytes) { + size_t handle_size = sizeof(LRUHandle) - 1 + key.size(); + auto* e = reinterpret_cast<LRUHandle*>(malloc(handle_size)); + g_doris_cache_dummy_usage_num << 1; Review Comment: fixed ########## be/src/olap/lru_cache.cpp: ########## @@ -667,4 +669,43 @@ void ShardedLRUCache::update_cache_metrics() const { total_lookup_count == 0 ? 0 : ((double)total_hit_count / total_lookup_count)); } +Cache::Handle* DummyLRUCache::insert(const CacheKey& key, void* value, size_t charge, + void (*deleter)(const CacheKey& key, void* value), + CachePriority priority, size_t bytes) { + size_t handle_size = sizeof(LRUHandle) - 1 + key.size(); + auto* e = reinterpret_cast<LRUHandle*>(malloc(handle_size)); + g_doris_cache_dummy_usage_num << 1; + e->value = value; + e->deleter = deleter; + e->charge = charge; + e->key_length = key.size(); + e->total_size = 0; + e->bytes = 0; + e->hash = 0; + e->refs = 1; // only one for the returned handle + e->next = e->prev = nullptr; + e->in_cache = false; + e->priority = priority; + memcpy(e->key_data, key.data(), key.size()); + return reinterpret_cast<Cache::Handle*>(e); +} + +void DummyLRUCache::release(Cache::Handle* handle) { + if (handle == nullptr) { + return; + } + auto* e = reinterpret_cast<LRUHandle*>(handle); + e->free(); + g_doris_cache_dummy_usage_num << -1; Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org