1 Star 0 Fork 1

wfbr-dorder/Lru

forked from lianxm/Lru 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
LRUcache.h 1.25 KB
一键复制 编辑 原始数据 按行查看 历史
lianxm 提交于 2018-04-25 23:16 . Upload main.cpp LRUcache.cpp LRUcache.h
#ifndef LRUCACHE_H_INCLUDED
#define LRUCACHE_H_INCLUDED
typedef struct Entrys CacheEntry;
struct Entrys
{
char key;
char value;
CacheEntry *ListNext;
CacheEntry *ListPre;
CacheEntry *HashNext;
CacheEntry *HashPre;
};
typedef struct
{
CacheEntry **HashArray; //哈希数组
CacheEntry *ListBegin; //指向链表头节点
CacheEntry *ListEnd; //指向链表尾节点
int CacheCapacity; //所容纳的容量
int NowCapacity; //现在的容量
} LruCache;
void printCache(LruCache *lru);
void cachePush(LruCache *lru , char key , char value);
void LruCacheDestory(LruCache *lru);
CacheEntry* getValueThroughKey(LruCache *lru , char key);
CacheEntry* findKey(LruCache *lru , char key);
LruCache* newLruCache(int capacity);
/*
static CacheEntry* newCacheEntry(char key , char value);
static void removeEntryFromLru(LruCache *lru , CacheEntry *entry);
static void removeEndEntryFromLru(LruCache *lru);
static void addEntryInLruBegin(LruCache *lru , CacheEntry *entry);
static void removeEntryFromHash(LruCache *lru , CacheEntry *entry);
static void addEntryToHash(LruCache *lru , CacheEntry *entry);
static int getHashKey(LruCache *lru , char key);
*/
#endif // LRUCACHE_H_INCLUDED
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/wfbr-dorder/Lru.git
git@gitee.com:wfbr-dorder/Lru.git
wfbr-dorder
Lru
Lru
master

搜索帮助