acelyc111 commented on a change in pull request #5008: URL: https://github.com/apache/incubator-doris/pull/5008#discussion_r538049137
########## File path: be/src/olap/page_cache.h ########## @@ -53,36 +54,44 @@ class StoragePageCache { }; // Create global instance of this class - static void create_global_cache(size_t capacity); + static void create_global_cache(size_t capacity, double index_cache_ratio); // Return global instance. // Client should call create_global_cache before. static StoragePageCache* instance() { return _s_instance; } - StoragePageCache(size_t capacity); + StoragePageCache(size_t capacity, double index_cache_ratio); // Lookup the given page in the cache. // // If the page is found, the cache entry will be written into handle. // PageCacheHandle will release cache entry to cache when it // destructs. // + // Cache type selection is determined by page_type argument + // // Return true if entry is found, otherwise return false. - bool lookup(const CacheKey& key, PageCacheHandle* handle); + bool lookup(const CacheKey& key, PageCacheHandle* handle, segment_v2::PageTypePB page_type); // Insert a page with key into this cache. // Given handle will be set to valid reference. // This function is thread-safe, and when two clients insert two same key // concurrently, this function can assure that only one page is cached. // The in_memory page will have higher priority. void insert(const CacheKey& key, const Slice& data, PageCacheHandle* handle, - bool in_memory = false); + segment_v2::PageTypePB page_type, bool in_memory = false); + + // Page cache available check. + // When ratio is set to 0 or 1, the index or data cache will not be allocated. + bool is_cache_available(segment_v2::PageTypePB page_type); Review comment: Better to define it as a static function ---------------------------------------------------------------- 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. 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