Skip to content

Commit 284a7dc

Browse files
authored
Update CacheManager.h
1 parent 9fc08f2 commit 284a7dc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

include/CacheManager.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
#include "LRUCache.h"
66
#include <atomic>
77
#include <mutex>
8+
#include <string>
89

910
class CacheManager {
1011
public:
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

1718
private:
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

0 commit comments

Comments
 (0)