MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / removeAllCachedValues

Method removeAllCachedValues

src/db.cpp:3142–3162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3140}
3141
3142void redisDbPersistentData::removeAllCachedValues()
3143{
3144 // First we have to flush the tracked changes
3145 if (m_fTrackingChanges)
3146 {
3147 if (processChanges(false))
3148 commitChanges();
3149 trackChanges(false);
3150 }
3151
3152 if (m_pdict->pauserehash == 0 && m_pdict->refcount == 1) {
3153 dict *dT = m_pdict;
3154 m_pdict = dictCreate(&dbDictType, this);
3155 dictExpand(m_pdict, dictSize(dT)/2, false); // Make room for about half so we don't excessively rehash
3156 g_pserver->asyncworkqueue->AddWorkFunction([dT]{
3157 dictRelease(dT);
3158 }, false);
3159 } else {
3160 dictEmpty(m_pdict, nullptr);
3161 }
3162}
3163
3164void redisDbPersistentData::disableKeyCache()
3165{

Callers 3

flushdbCommandFunction · 0.80
flushallCommandFunction · 0.80
performEvictionsFunction · 0.80

Calls 5

dictEmptyFunction · 0.85
AddWorkFunctionMethod · 0.80
dictCreateFunction · 0.70
dictExpandFunction · 0.70
dictReleaseFunction · 0.70

Tested by

no test coverage detected