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++;
121
ValueWithTimestamp
&
vwt
=
mMap
[
key
];
122
vwt
.last_access_time =
curr
;
123
return
vwt
.value;
124
}
fl::HashMapLru::mMaxSize
fl::size mMaxSize
Definition
unordered_map_lru.h:171
fl::HashMapLru::mMap
unordered_map< Key, ValueWithTimestamp, Hash, KeyEqual, INLINED_COUNT > mMap
Definition
unordered_map_lru.h:170
fl::HashMapLru::mCurrentTime
u32 mCurrentTime
Definition
unordered_map_lru.h:172
fl::HashMapLru::evictOldest
void evictOldest()
Definition
unordered_map_lru.h:143
fl::HashMapLru
Definition
unordered_map_lru.h:22
fl::HashMapLru::ValueWithTimestamp
Definition
unordered_map_lru.h:25
fl
HashMapLru
Generated on Tue Jun 16 2026 00:07:05 for FastLED by
1.13.2