CacheToFile is a java library to cache your data. This library store your java object in to file system.so no worry about loss your data when server is restarted.
Create object :
private CacheToFile cacheToFile = new CacheToFile("/Users/administrator/Downloads");
if (cacheToFile.has("you key")) {
out.println(cacheToFile.get("your key"));
out.println("From cache");
} else {
//Some long operation
boolean cached = cacheToFile.put("your key", <your object>, <Cache unit>, <Unit value>);
}
out.println(cacheToFile.get("your key"));
out.println("From not cache");
}
- CacheToFile.unit.DAY
- CacheToFile.unit.HOUR
- CacheToFile.unit.MINUTE
Provide valid Integer value