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

Method removeCachedValue

src/db.cpp:3100–3126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3098}
3099
3100bool redisDbPersistentData::removeCachedValue(const char *key, dictEntry **ppde)
3101{
3102 serverAssert(m_spstorage != nullptr);
3103 // First ensure its not a pending key
3104 if (m_spstorage != nullptr)
3105 m_spstorage->batch_lock();
3106
3107 dictEntry *de = dictFind(m_dictChanged, key);
3108 if (de != nullptr)
3109 {
3110 if (m_spstorage != nullptr)
3111 m_spstorage->batch_unlock();
3112 return false; // can't evict
3113 }
3114
3115 // since we write ASAP the database already has a valid copy so safe to delete
3116 if (ppde != nullptr) {
3117 *ppde = dictUnlink(m_pdict, key);
3118 } else {
3119 dictDelete(m_pdict, key);
3120 }
3121
3122 if (m_spstorage != nullptr)
3123 m_spstorage->batch_unlock();
3124
3125 return true;
3126}
3127
3128redisDbPersistentData::redisDbPersistentData() {
3129 m_dictChanged = dictCreate(&dictChangeDescType, nullptr);

Callers 1

performEvictionsFunction · 0.80

Calls 5

dictUnlinkFunction · 0.85
dictFindFunction · 0.70
dictDeleteFunction · 0.70
batch_lockMethod · 0.45
batch_unlockMethod · 0.45

Tested by

no test coverage detected