电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

java缓存

java缓存_第1页
1/21
java缓存_第2页
2/21
java缓存_第3页
3/21
JAVA 缓存  1 Cache 类  2 CacheManager类 JAVA 缓存有两种: 一、文件缓存,是指把数据存储在磁盘上,可以XML 格式,也可以序列化文件DAT 格式还是其它文件格式。 二、内存缓存,也就是实现一个类中静态Map,对这个Map 进行常规的增删查。 其代码如下: JAVA 缓存 - Cache 类 public class Cache { private String key;//缓存ID private Object value;//缓存数据 private long timeOut;//更新时间 private boolean expired; //是否终止 public Cache() { super(); } public Cache(String key, Object value, long timeOut, boolean expired) { this.key = key; this.value = value; this.timeOut = timeOut; this.expired = expired; } public String getKey() { return key; } public long getTimeOut() { return timeOut; } public Object getValue() { return value; } public void setKey(String string) { key = string; } public void setTimeOut(long l) { timeOut = l; } public void setValue(Object object) { value = object; } public booleanisExpired() { return expired; } public void setExpired(boolean b) { expired = b; } } //测试类, class Test { public static void main(String[] args) { System.out.println(CacheManager.getSimpleFlag("alksd")); // CacheManager.putCache("abc", new Cache()); // CacheManager.putCache("def", new Cache()); // CacheManager.putCache("ccc", new Cache()); // CacheManager.clearOnly(""); // Cache c = new Cache(); // for (int i = 0; i < 10; i++) { // CacheManager.putCache("" + i, c); // } // CacheManager.putCache("aaaaaaaa", c); // CacheManager.putCache("abchcy;alskd", c); // CacheManager.putCache("cccccccc", c); // CacheManager.putCache("abcoqiwhcy", c); // System.out.println("删除前的大小:"+CacheManager.getCacheSize()); // CacheManager.getCacheAllkey(); // CacheManager.clearAll("aaaa"); // System.out.println("删除后的大小:"+CacheManager.getCacheSize()); // CacheManager.getCacheAllkey(); } } JAVA 缓存...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部