[opt](memory) All LRU Cache inherit from LRUCachePolicy (#28940)

After all LRU Cache inherits from LRUCachePolicy, this will allow prune stale entry, eviction when memory exceeds limit, and define common properties. LRUCache constructor change to private, only allow LRUCachePolicy to construct it.

Impl DummyLRUCache, when LRU Cache capacity is 0, will no longer be meaningless insert and evict.
This commit is contained in:
Xinyi Zou
2023-12-29 16:15:56 +08:00
committed by GitHub
parent 866fd5d32a
commit 82635d4b59
30 changed files with 367 additions and 207 deletions

View File

@ -21,8 +21,8 @@
namespace doris {
CachePolicy::CachePolicy(CacheType type, uint32_t stale_sweep_time_s)
: _type(type), _stale_sweep_time_s(stale_sweep_time_s) {
CachePolicy::CachePolicy(CacheType type, uint32_t stale_sweep_time_s, bool enable_prune)
: _type(type), _stale_sweep_time_s(stale_sweep_time_s), _enable_prune(enable_prune) {
_it = CacheManager::instance()->register_cache(this);
init_profile();
}