| 82 | } |
| 83 | |
| 84 | CacheShard* NewCacheShard(Cache::EvictionPolicy policy, kudu::MemTracker* mem_tracker, |
| 85 | size_t capacity) { |
| 86 | switch (policy) { |
| 87 | case Cache::EvictionPolicy::FIFO: |
| 88 | return NewCacheShardInt<Cache::EvictionPolicy::FIFO>(mem_tracker, capacity); |
| 89 | case Cache::EvictionPolicy::LRU: |
| 90 | return NewCacheShardInt<Cache::EvictionPolicy::LRU>(mem_tracker, capacity); |
| 91 | case Cache::EvictionPolicy::LIRS: |
| 92 | return NewCacheShardInt<Cache::EvictionPolicy::LIRS>(mem_tracker, capacity); |
| 93 | default: |
| 94 | LOG(FATAL) << "unexpected cache eviction policy: " << static_cast<int>(policy); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | Cache* NewCache(Cache::EvictionPolicy policy, size_t capacity, const std::string& id) { |
| 99 | return new ShardedCache(policy, capacity, id); |