@@ -0,0 +1,1166 @@
+package cache;%0A%0Aimport java.io.*;%0A%0A/**%0A * @author kamontat%0A * @version 1.0%0A * @since 1/28/2017 AD - 1:04 AM%0A */%0Apublic class Cache %7B%0A%09// setting file%0A%09private String path = %22%22;%0A%09private String name = %22Caches%22;%0A%09%0A%09private File file = new File(path + name);%0A%09// singleton%0A%09private static Cache cache;%0A%09%0A%09public static Cache loadCache() %7B%0A%09%09if (cache == null) cache = new Cache();%0A%09%09return cache;%0A%09%7D%0A%09%0A%09public Cache setFilePath(String path) %7B%0A%09%09cache.path = path;%0A%09%09updateLocation();%0A%09%09return cache;%0A%09%7D%0A%09%0A%09public Cache setFileName(String name) %7B%0A%09%09cache.name = name;%0A%09%09updateLocation();%0A%09%09return cache;%0A%09%7D%0A%09%0A%09public %3CE%3E void saveToFile(E obj) %7B%0A%09%09try %7B%0A%09%09%09ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(file));%0A%09%09%09oos.writeObject(obj);%0A%09%09%09oos.close();%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%7D%0A%09%0A%09public %3CE%3E E loadFromFile(Class%3CE%3E eClass) %7B%0A%09%09try %7B%0A%09%09%09ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file));%0A%09%09%09return (E) ois.readObject();%0A%09%09%7D catch (IOException %7C ClassNotFoundException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09return null;%0A%09%7D%0A%09%0A%09private void updateLocation() %7B%0A%09%09file = new File(path + name);%0A%09%7D%0A%7D%0A

add cache management