Info command should show how many keys are cached in RAM vs storage provider
Former-commit-id: 08597bee69bc16ca7c3d5ff31020472774c6eec9
This commit is contained in:
parent
bd74913b8e
commit
fc7221739c
@ -2963,13 +2963,13 @@ dict_iter redisDbPersistentData::random()
|
||||
return dict_iter(m_pdict, de);
|
||||
}
|
||||
|
||||
size_t redisDbPersistentData::size() const
|
||||
size_t redisDbPersistentData::size(bool fCachedOnly) const
|
||||
{
|
||||
if (m_spstorage != nullptr && !m_fAllChanged)
|
||||
if (m_spstorage != nullptr && !m_fAllChanged && !fCachedOnly)
|
||||
return m_spstorage->count() + m_cnewKeysPending;
|
||||
|
||||
return dictSize(m_pdict)
|
||||
+ (m_pdbSnapshot ? (m_pdbSnapshot->size() - dictSize(m_pdictTombstone)) : 0);
|
||||
+ (m_pdbSnapshot ? (m_pdbSnapshot->size(fCachedOnly) - dictSize(m_pdictTombstone)) : 0);
|
||||
}
|
||||
|
||||
bool redisDbPersistentData::removeCachedValue(const char *key)
|
||||
|
@ -6096,10 +6096,11 @@ sds genRedisInfoString(const char *section) {
|
||||
if (sections++) info = sdscat(info,"\r\n");
|
||||
info = sdscatprintf(info, "# Keyspace\r\n");
|
||||
for (j = 0; j < cserver.dbnum; j++) {
|
||||
long long keys, vkeys;
|
||||
long long keys, vkeys, cachedKeys;
|
||||
|
||||
keys = g_pserver->db[j]->size();
|
||||
vkeys = g_pserver->db[j]->expireSize();
|
||||
cachedKeys = g_pserver->db[j]->size(true /* fCachedOnly */);
|
||||
|
||||
// Adjust TTL by the current time
|
||||
mstime_t mstime;
|
||||
@ -6111,8 +6112,8 @@ sds genRedisInfoString(const char *section) {
|
||||
|
||||
if (keys || vkeys) {
|
||||
info = sdscatprintf(info,
|
||||
"db%d:keys=%lld,expires=%lld,avg_ttl=%lld\r\n",
|
||||
j, keys, vkeys, static_cast<long long>(g_pserver->db[j]->avg_ttl));
|
||||
"db%d:keys=%lld,expires=%lld,avg_ttl=%lld,cached_keys=%lld\r\n",
|
||||
j, keys, vkeys, static_cast<long long>(g_pserver->db[j]->avg_ttl), cachedKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1095,7 +1095,7 @@ public:
|
||||
redisDbPersistentData(redisDbPersistentData &&) = default;
|
||||
|
||||
size_t slots() const { return dictSlots(m_pdict); }
|
||||
size_t size() const;
|
||||
size_t size(bool fCachedOnly = false) const;
|
||||
void expand(uint64_t slots) { dictExpand(m_pdict, slots); }
|
||||
|
||||
void trackkey(robj_roptr o, bool fUpdate)
|
||||
|
Loading…
x
Reference in New Issue
Block a user