mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-14 23:57:49 +00:00
Use a different approach for the LRU toggle
This commit is contained in:
parent
b5bec371ae
commit
bb2f527b16
3 changed files with 23 additions and 9 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <list>
|
||||
#include <unordered_map>
|
||||
#include <optional>
|
||||
#include "common/logging/log.h"
|
||||
|
||||
template<typename KeyType, typename ValueType>
|
||||
class LRUCache {
|
||||
|
@ -15,6 +16,7 @@ private:
|
|||
public:
|
||||
explicit LRUCache(size_t capacity, bool enabled = true) : enabled(enabled), capacity(capacity) {
|
||||
cache_map.reserve(capacity);
|
||||
LOG_WARNING(Core, "LRU Cache initialized with state: {}", enabled ? "enabled" : "disabled");
|
||||
}
|
||||
|
||||
// Returns pointer to value if found, nullptr otherwise
|
||||
|
@ -67,6 +69,7 @@ public:
|
|||
// Enable or disable the LRU cache
|
||||
void setEnabled(bool state) {
|
||||
enabled = state;
|
||||
LOG_WARNING(Core, "LRU Cache state changed to: {}", state ? "enabled" : "disabled");
|
||||
if (!enabled) {
|
||||
clear();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue