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 93 of file hash_map_lru.h.

93 {
94 // If we're at capacity and this is a new key, evict oldest
95 auto curr = mCurrentTime++;
96
97 auto entry = mMap.find_value(key);
98 if (entry) {
99 // Update access time
100 entry->last_access_time = curr;
101 return entry->value;
102 }
103
104 if (mMap.size() >= mMaxSize) {
105 evictOldest();
106 }
107
108 // Get or create entry and update timestamp
109 // mCurrentTime++;
111 vwt.last_access_time = curr;
112 return vwt.value;
113 }
HashMap< Key, ValueWithTimestamp, Hash, KeyEqual, INLINED_COUNT > mMap
uint32_t mCurrentTime

References evictOldest(), fl::HashMapLru< Key, T, Hash, KeyEqual, INLINED_COUNT >::ValueWithTimestamp::last_access_time, mCurrentTime, mMap, mMaxSize, and fl::HashMapLru< Key, T, Hash, KeyEqual, INLINED_COUNT >::ValueWithTimestamp::value.

+ Here is the call graph for this function: