FastLED 3.9.15
Loading...
Searching...
No Matches

◆ evictOldest()

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
void fl::HashMapLru< Key, T, Hash, KeyEqual, INLINED_COUNT >::evictOldest ( )
inlineprivate

Definition at line 131 of file hash_map_lru.h.

131 {
132 if (mMap.empty())
133 return;
134
135 // Find the entry with the oldest timestamp
138 bool found = false;
139
140 for (auto it = mMap.begin(); it != mMap.end(); ++it) {
141 const auto &entry = *it;
142 const ValueWithTimestamp &vwt = entry.second;
143
144 if (vwt.last_access_time < oldest_time) {
145 oldest_time = vwt.last_access_time;
146 oldest_key = entry.first;
147 found = true;
148 }
149 }
150
151 // Remove the oldest entry
152 if (found) {
153 mMap.remove(oldest_key);
154 }
155 }
HashMap< Key, ValueWithTimestamp, Hash, KeyEqual, INLINED_COUNT > mMap

References fl::HashMapLru< Key, T, Hash, KeyEqual, INLINED_COUNT >::ValueWithTimestamp::last_access_time, and mMap.

Referenced by insert(), operator[](), and setMaxSize().

+ Here is the caller graph for this function: