Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 794 Bytes

README.md

File metadata and controls

27 lines (22 loc) · 794 Bytes

CacheToFile

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.

How to use

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");
}

Cache unit

  1. CacheToFile.unit.DAY
  2. CacheToFile.unit.HOUR
  3. CacheToFile.unit.MINUTE

Unit value

Provide valid Integer value