资源简介
用Java写的一个Cache,内部实现了LRU算法~
代码片段和文件信息
import java.util.HashMap;
/**********************此为缓存模块主要用于实现缓存对外界操作请求的相应**************************************************************************************************/
public class Cache {
public static HashMap cache;//缓存,通过HashMap实现缓存的机制,通过静态的HashMap,使得HashMap能够一直保持在内存中
private static int cacheSize; //缓存大小为确定值
public Cache(int cachesize) {
cacheSize = cachesize;
cache = new HashMap();
}//初始化缓存模块,根据指定的缓存大小来固定HashMap的最大容量
public boolean insertPage(String trainString trainInfo) {
cache.put(train trainInfo);
return true;
}//对外提供插入页的接口插入成功返回true
public boolean deletePage(String train) {
cache.remove(train);
return true;
}//对外提供删除指定页的接口,删除成功返回true
public String searchPage(String train)
{
String s =cache.get(train);
return cache.get(train);
}//对外提供缓存查询的接口,查询不到返回null
public int getCacheSize() //返回缓存大小
{
return cacheSize;
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2012-03-22 09:37 CacheMemory\.classpath
文件 387 2012-03-22 09:37 CacheMemory\.project
文件 629 2012-03-22 09:37 CacheMemory\.settings\org.eclipse.jdt.core.prefs
文件 1203 2012-03-27 20:16 CacheMemory\bin\Cache.class
文件 4139 2012-04-01 14:16 CacheMemory\bin\CacheManagement.class
文件 1422 2012-04-01 14:16 CacheMemory\bin\client.class
文件 2668 2012-03-27 20:29 CacheMemory\bin\CMDManagement.class
文件 1116 2012-03-27 20:16 CacheMemory\bin\GetStatusData.class
文件 538 2012-03-27 20:29 CacheMemory\bin\SQLManagement.class
文件 1238 2012-03-31 18:35 CacheMemory\bin\TimerReflash.class
文件 1100 2012-03-27 20:16 CacheMemory\src\Cache.java
文件 5578 2012-04-01 14:16 CacheMemory\src\CacheManagement.java
文件 907 2012-04-01 14:16 CacheMemory\src\client.java
文件 2033 2012-03-27 20:29 CacheMemory\src\CMDManagement.java
文件 586 2012-03-27 20:16 CacheMemory\src\GetStatusData.java
文件 433 2012-03-27 20:29 CacheMemory\src\SQLManagement.java
文件 673 2012-03-31 18:35 CacheMemory\src\TimerReflash.java
目录 0 2012-03-22 09:37 CacheMemory\.settings
目录 0 2012-03-27 19:29 CacheMemory\bin
目录 0 2012-03-27 19:29 CacheMemory\src
目录 0 2012-03-22 09:37 CacheMemory
----------- --------- ---------- ----- ----
24951 21
- 上一篇:基于客户端通信的DES加密的java实现
- 下一篇:Java图书馆借书还书系统
相关资源
- tomcat 采用msm连接memcached缓存session所需
- Java+MySQL+redis缓存
- java 缓存 cache lru
- Android WebView cache 缓存 腾讯X5内核在线
- Android WebView cache 缓存 在线 视频播放
- 2018-java-49期黑马程序员全套视频教程
- Android高德加载谷歌卫星瓦片并缓存本
- J2Cache 是 OSChina 目前正在使用的两级缓
- 一个简单的通过aidl读取应用包信息的
- Android-全网视频嗅探缓存APP-治疗你的
- Android WebView 实现缓存网页数据
- memcached缓存
- cache模拟器
- java高速文件缓存
- 缓存的jar包 ehcache-2.8.3
- Android获取第三方应用的占用大小,包
- java 清缓存工具
- douBanList(滚动到底部加载新的,软缓
- 网络获取图片缓存
- Android-Image-Cache 图片缓存 类库
- 缓存的计算清除
- Android-webview缓存
- 使用SQLite缓存数据(缓存文本和大图
- Android实战——RxJava2解锁图片三级缓存
川公网安备 51152502000135号
评论
共有 条评论