Skip to content

Commit

Permalink
Enable key cache for async reads
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSully committed Mar 5, 2024
1 parent 7a488a8 commit 8a2016a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/StorageCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,22 @@ void StorageCache::retrieve(sds key, IStorage::callbackSingle fn) const
}

StorageToken *StorageCache::begin_retrieve(struct aeEventLoop *el, aePostFunctionTokenProc proc, sds *rgkey, size_t ckey) {
#if 0
std::unique_lock<fastlock> ul(m_lock);
if (m_pdict != nullptr)
{
uint64_t hash = dictSdsHash(key);
dictEntry *de = dictFind(m_pdict, reinterpret_cast<void*>(hash));

if (de == nullptr)
return nullptr; // Not found
bool fAnyKey = false;
for (size_t ik = 0; ik < ckey; ++ik) {
uint64_t hash = dictSdsHash(rgkey[ik]);
dictEntry *de = dictFind(m_pdict, reinterpret_cast<void*>(hash));

if (de != nullptr)
fAnyKey = true;
}
if (!fAnyKey)
return nullptr; // All keys are missing - skip the io
}
ul.unlock();
#endif

return m_spstorage->begin_retrieve(el, proc, rgkey, ckey);
}

Expand Down

0 comments on commit 8a2016a

Please sign in to comment.