MCPcopy Create free account
hub / github.com/NativeScript/android / evict

Method evict

test-app/runtime/src/main/cpp/LRUCache.h:142–157  ·  view source on GitHub ↗

Purge the least-recently-used element in the cache

Source from the content-addressed store, hash-verified

140
141 // Purge the least-recently-used element in the cache
142 void evict() {
143 // Assert method is never called when cache is empty
144 assert(!m_key_tracker.empty());
145
146 // Identify least recently used key
147 auto it = m_key_to_value.find(m_key_tracker.front());
148 assert(it != m_key_to_value.end());
149
150 if (m_evictCallback != nullptr) {
151 m_evictCallback((*it).second.first, m_state);
152 }
153
154 // Erase both elements to completely purge record
155 m_key_to_value.erase(it);
156 m_key_tracker.pop_front();
157 }
158
159 // The function to be cached
160 value_type (*m_loadCallback)(const key_type&, void*);

Callers

nothing calls this directly

Calls 5

frontMethod · 0.80
eraseMethod · 0.80
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected