forked from xtaci/algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLRU_cache_demo.cpp
More file actions
35 lines (24 loc) · 837 Bytes
/
Copy pathLRU_cache_demo.cpp
File metadata and controls
35 lines (24 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <iostream>
#include "LRU_cache.h"
using namespace std;
using namespace alg;
int main() {
LRUCache<string,string> Cache(5);
Cache.putValue("key1","value1");
Cache.putValue("key2","value2");
Cache.putValue("key3","value3");
Cache.putValue("key4","value4");
Cache.putValue("key5","value5");
Cache.putValue("key6","value6");
cout << "Display The LRU Cache...." << endl;
Cache.display();
cout << "Now,Visit the LRU Cache with \"key4\"" << endl;
cout << "The \"key4\" Value is : "<< Cache.getValue("key4") << endl;
cout << "The New LRU Cache is ... " << endl;
Cache.display();
cout << "Now, Update The LRU Cache with \"key5\" and new value is \"newValue5\" ... " << endl;
Cache.putValue("key5","newValue5");
cout << "The New LRU Cache is ... " << endl;
Cache.display();
Cache.getValue("aaa");
}