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 143 of file unordered_map_lru.h.

143 {
144 if (mMap.empty())
145 return;
146
147 // Find the entry with the oldest timestamp
149 // Use (max)() to prevent macro expansion by Arduino.h's max macro
151 bool found = false;
152
153 for (auto it = mMap.begin(); it != mMap.end(); ++it) {
154 const auto &entry = *it;
155 const ValueWithTimestamp &vwt = entry.second;
156
157 if (vwt.last_access_time < oldest_time) {
158 oldest_time = vwt.last_access_time;
159 oldest_key = entry.first;
160 found = true;
161 }
162 }
163
164 // Remove the oldest entry
165 if (found) {
166 mMap.remove(oldest_key);
167 }
168 }
unordered_map< Key, ValueWithTimestamp, Hash, KeyEqual, INLINED_COUNT > mMap

Referenced by fl::HashMapLru< Args, fl::shared_ptr< Impl > >::insert(), fl::HashMapLru< Args, fl::shared_ptr< Impl > >::operator[](), and fl::HashMapLru< Args, fl::shared_ptr< Impl > >::setMaxSize().

+ Here is the caller graph for this function: