-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlru-cache.cc
More file actions
78 lines (59 loc) · 1.19 KB
/
lru-cache.cc
File metadata and controls
78 lines (59 loc) · 1.19 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "iostream"
#include "common.h"
using namespace std;
template<typename V_T>
class LNode
{
public:
V_T m_v;
LNode* m_next;
LNode* m_pre;
LNode(const V_T& p_v)
{
m_v=p_v;
m_next=NULL;
m_pre=NULL;
}
void GetRidOf(LNode* n)
{
n->m_pre->m_next=n->m_next;
n->m_next->m_pre=n->m_pre;
}
void Insert(LNode* prev, V_T& v)
{
prev->m_pre
}
};
void test1()
{
}
template<typename KeyT, typename ValueT>
class LruCache
{
public:
LruCache(size_t p_cacheTableSize)
{
}
LruCache()
{
}
~LruCache()
{
}
//if the value is exsit in cache, the value will be in p_v and return true;
//if the value is not exist in cache, the function will return false
bool Read(const KeyT& p_key, ValueT& p_v)
{
return true;
}
void Write(const KeyT& p_key, const ValueT& p_v)
{
return;
}
private:
size_t m_size;
size_t current_size;
};
int main()
{
}