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

◆ operator[]()

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
T & fl::HashMapLru< Key, T, Hash, KeyEqual, INLINED_COUNT >::operator[] ( const Key & key)
inline

Definition at line 104 of file unordered_map_lru.h.

104 {
105 // If we're at capacity and this is a new key, evict oldest
106 auto curr = mCurrentTime++;
107
108 auto entry = mMap.find_value(key);
109 if (entry) {
110 // Update access time
111 entry->last_access_time = curr;
112 return entry->value;
113 }
114
115 if (mMap.size() >= mMaxSize) {
116 evictOldest();
117 }
118
119 // Get or create entry and update timestamp
120 // mCurrentTime++;
122 vwt.last_access_time = curr;
123 return vwt.value;
124 }
unordered_map< Key, ValueWithTimestamp, Hash, KeyEqual, INLINED_COUNT > mMap