diff --git a/cache/clock_cache.cc b/cache/clock_cache.cc index 3fa4c3659..89173834e 100644 --- a/cache/clock_cache.cc +++ b/cache/clock_cache.cc @@ -234,7 +234,7 @@ struct CleanupContext { }; // A cache shard which maintains its own CLOCK cache. -class ClockCacheShard : public CacheShard { +class ClockCacheShard final : public CacheShard { public: // Hash map type. typedef tbb::concurrent_hash_map HashTable; @@ -672,7 +672,7 @@ void ClockCacheShard::EraseUnRefEntries() { Cleanup(context); } -class ClockCache : public ShardedCache { +class ClockCache final : public ShardedCache { public: ClockCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit) : ShardedCache(capacity, num_shard_bits, strict_capacity_limit) { diff --git a/cache/lru_cache.h b/cache/lru_cache.h index 665a97a5c..0d9a31748 100644 --- a/cache/lru_cache.h +++ b/cache/lru_cache.h @@ -165,7 +165,7 @@ class LRUHandleTable { }; // A single shard of sharded cache. -class ALIGN_AS(CACHE_LINE_SIZE) LRUCacheShard : public CacheShard { +class ALIGN_AS(CACHE_LINE_SIZE) LRUCacheShard final : public CacheShard { public: LRUCacheShard(size_t capacity, bool strict_capacity_limit, double high_pri_pool_ratio, bool use_adaptive_mutex); @@ -284,7 +284,11 @@ class ALIGN_AS(CACHE_LINE_SIZE) LRUCacheShard : public CacheShard { mutable port::Mutex mutex_; }; -class LRUCache : public ShardedCache { +class LRUCache +#ifdef NDEBUG + final +#endif + : public ShardedCache { public: LRUCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit, double high_pri_pool_ratio,