llarp::util::DecayingHashTable

More...

Public Functions

Name
DecayingHashTable(std::chrono::milliseconds cacheInterval =1h)
void Decay(llarp_time_t now)
bool Has(const Key_t & k) const
return if we have this value by key
bool Put(Key_t key, Value_t value, llarp_time_t now =0s)
return true if inserted return false if not inserted
std::optional< Value_t > Get(Key_t k) const
get value by key
void Remove(const Key_t & key)
explicit remove an item from the cache by key

Detailed Description

template <typename Key_t ,
typename Value_t ,
typename Hash_t  =std::hash<Key_t>>
struct llarp::util::DecayingHashTable;

Public Functions Documentation

function DecayingHashTable

inline DecayingHashTable(
    std::chrono::milliseconds cacheInterval =1h
)

function Decay

inline void Decay(
    llarp_time_t now
)

function Has

inline bool Has(
    const Key_t & k
) const

return if we have this value by key

function Put

inline bool Put(
    Key_t key,
    Value_t value,
    llarp_time_t now =0s
)

return true if inserted return false if not inserted

function Get

inline std::optional< Value_t > Get(
    Key_t k
) const

get value by key

function Remove

inline void Remove(
    const Key_t & key
)

explicit remove an item from the cache by key


Updated on 2026-01-10 at 22:49:45 +0000