Function find

Synopsis

#include <lib/inc/drogon/CacheMap.h>

bool find(const T1 &key)

Description

Check if the value of the keyword exists.

Source

Lines 242-259 in lib/inc/drogon/CacheMap.h.

bool find(const T1 &key)
{
    int timeout = 0;
    bool flag = false;
    std::lock_guard<std::mutex> lock(mtx_);
    auto iter = map_.find(key);
    if (iter != map_.end())
    {
        timeout = iter->second.timeout;
        flag = true;
    }
    if (timeout > 0)
        eraseAfter(timeout, key);
    return flag;
}





Add Discussion as Guest

Log in to DocsForge