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

Method insert

src/StorageCache.cpp:117–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117void StorageCache::insert(sds key, const void *data, size_t cbdata, bool fOverwrite)
118{
119 std::unique_lock<fastlock> ul(m_lock);
120 if (!fOverwrite && m_pdict != nullptr)
121 {
122 cacheKey(key);
123 }
124 ul.unlock();
125 m_spstorage->insert(key, sdslen(key), (void*)data, cbdata, fOverwrite);
126 auto e = deserializeExpire((const char *)data, cbdata, nullptr);
127 if (e != nullptr)
128 m_spstorage->setExpire(key, sdslen(key), e->when());
129}
130
131long _dictKeyIndex(dict *d, const void *key, uint64_t hash, dictEntry **existing);
132void StorageCache::bulkInsert(char **rgkeys, size_t *rgcbkeys, char **rgvals, size_t *rgcbvals, size_t celem)

Callers

nothing calls this directly

Calls 5

sdslenFunction · 0.85
deserializeExpireFunction · 0.85
unlockMethod · 0.45
setExpireMethod · 0.45
whenMethod · 0.45

Tested by

no test coverage detected