File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 55#include " LRUCache.h"
66#include < atomic>
77#include < mutex>
8+ #include < string>
89
910class CacheManager {
1011public:
11- CacheManager (int capacity);
12- void setPolicy (int policy);
13- void accessCache (int key, int value);
14- // Modified to accept a stop flag
12+ CacheManager (size_t capacity);
13+ int get (int key);
14+ void put (int key, int value);
1515 void switchPolicy (std::atomic<bool >& stop_flag);
16+ std::string getCurrentPolicyName () const ;
1617
1718private:
18- enum { LFU = 0 , LRU = 1 };
19+ enum Policy { LFU_P, LRU_P };
1920
2021 LFUCache lfu_cache;
2122 LRUCache lru_cache;
22- std::atomic<int > current_policy;
23+ std::atomic<Policy > current_policy;
2324 std::mutex policy_mutex;
24- std::mutex access_mutex;
2525};
2626
2727#endif // CACHEMANAGER_H
You can’t perform that action at this time.
0 commit comments