14template <
typename Key,
typename T,
typename Hash = Hash<Key>,
15 typename KeyEqual = EqualTo<Key>,
16 int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
71 mMap.insert(key, vwt);
89 return vwt ? &vwt->
value :
nullptr;
97 auto entry =
mMap.find_value(key);
100 entry->last_access_time = curr;
137 uint32_t oldest_time = UINT32_MAX;
140 for (
auto it =
mMap.begin(); it !=
mMap.end(); ++it) {
141 const auto &entry = *it;
146 oldest_key = entry.first;
153 mMap.remove(oldest_key);
void setMaxSize(size_t max_size)
HashMapLru(size_t max_size)
T & operator[](const Key &key)
HashMap< Key, ValueWithTimestamp, Hash, KeyEqual, INLINED_COUNT > mMap
T * find_value(const Key &key)
void insert(const Key &key, const T &value)
void swap(HashMapLru &other)
bool remove(const Key &key)
const T * find_value(const Key &key) const
void swap(array< T, N > &lhs, array< T, N > &rhs) noexcept(noexcept(lhs.swap(rhs)))
Implements a simple red square effect for 2D LED grids.
uint32_t last_access_time
ValueWithTimestamp(const T &v, uint32_t time)