From c79e5954716f5276d37ec7f4b2634a392ff2acca Mon Sep 17 00:00:00 2001 From: kailiu Date: Tue, 10 Dec 2013 17:34:35 -0800 Subject: [PATCH] Make Cache::GetCapacity constant Summary: This will allow us to access constant via `DB::GetOptions().table_cache.GetCapacity()` or `DB::GetOptions().block_cache.GetCapacity()` since GetOptions() is also constant method. --- include/rocksdb/cache.h | 2 +- util/cache.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/rocksdb/cache.h b/include/rocksdb/cache.h index 3e0e5c1cd..201d82f19 100644 --- a/include/rocksdb/cache.h +++ b/include/rocksdb/cache.h @@ -102,7 +102,7 @@ class Cache { virtual uint64_t NewId() = 0; // returns the maximum configured capacity of the cache - virtual size_t GetCapacity() = 0; + virtual size_t GetCapacity() const = 0; private: void LRU_Remove(Handle* e); diff --git a/util/cache.cc b/util/cache.cc index deec52864..b9d41be49 100644 --- a/util/cache.cc +++ b/util/cache.cc @@ -404,7 +404,7 @@ class ShardedLRUCache : public Cache { MutexLock l(&id_mutex_); return ++(last_id_); } - virtual size_t GetCapacity() { + virtual size_t GetCapacity() const { return capacity_; } };