Update Cache code format

This commit is contained in:
jinhai 2019-11-05 02:28:53 +08:00
parent 6a4147ddbe
commit 745ce13f46
2 changed files with 17 additions and 3 deletions

View File

@ -40,12 +40,15 @@ class Cache {
return usage_;
}
// unit: BYTE
int64_t
capacity() const {
return capacity_;
} // unit: BYTE
}
// unit: BYTE
void
set_capacity(int64_t capacity); // unit: BYTE
set_capacity(int64_t capacity);
double
freemem_percent() const {
@ -59,16 +62,22 @@ class Cache {
size_t
size() const;
bool
exists(const std::string& key);
ItemObj
get(const std::string& key);
void
insert(const std::string& key, const ItemObj& item);
void
erase(const std::string& key);
void
print();
void
clear();

View File

@ -53,14 +53,19 @@ class CacheMgr {
int64_t
CacheUsage() const;
int64_t
CacheCapacity() const;
void
SetCapacity(int64_t capacity);
protected:
CacheMgr();
virtual ~CacheMgr();
virtual
~CacheMgr();
protected:
using CachePtr = std::shared_ptr<Cache<ItemObj>>;