+ lru_timestamps_and_size.emplace_back(
+ key_and_value.second.last_used,
+ frame_size(*key_and_value.second.frame));
+ }
+ sort(lru_timestamps_and_size.begin(), lru_timestamps_and_size.end());
+
+ // Remove the oldest ones until we are below 90% of the cache used.
+ size_t lru_cutoff_point = 0;
+ for (const pair<size_t, size_t> &it : lru_timestamps_and_size) {
+ lru_cutoff_point = it.first;
+ bytes_still_to_remove -= it.second;
+ if (bytes_still_to_remove <= 0) break;