/** * Remove files if needed to make cache have less than maxBytes bytes file sizes. * This will remove oldest files first. * * @param maxBytes max number of bytes in cache. * @param sbuff write results here, null is ok. */ static public void cleanCache(long maxBytes, StringBuilder sbuff) { cleanCache(maxBytes, new FileAgeComparator(), sbuff); }
/** * Remove files if needed to make cache have less than maxBytes bytes file sizes. * This will remove oldest files first. * * @param maxBytes max number of bytes in cache. * @param sbuff write results here, null is ok. */ static public void cleanCache(long maxBytes, StringBuilder sbuff) { cleanCache(maxBytes, new FileAgeComparator(), sbuff); }
/** * Remove files if needed to make cache have less than maxBytes bytes file sizes. * This will remove oldest files first. * * @param maxBytes max number of bytes in cache. * @param sbuff write results here, null is ok. */ static public void cleanCache(long maxBytes, StringBuilder sbuff) { cleanCache(maxBytes, new FileAgeComparator(), sbuff); }
static public void main(String[] args) throws IOException { DiskCache.setRootDirectory("C:/temp/chill/"); make("C:/junk.txt"); make("C:/some/enchanted/evening/joots+3478.txt"); make("http://www.unidata.ucar.edu/some/enc hanted/eve'ning/nowrite.gibberish"); showCache(System.out); StringBuilder sbuff = new StringBuilder(); cleanCache(1000 * 1000 * 10, sbuff); System.out.println(sbuff); }
static public void main(String[] args) throws IOException { DiskCache.setRootDirectory("C:/temp/chill/"); make("C:/junk.txt"); make("C:/some/enchanted/evening/joots+3478.txt"); make("http://www.unidata.ucar.edu/some/enc hanted/eve'ning/nowrite.gibberish"); showCache(System.out); StringBuilder sbuff = new StringBuilder(); cleanCache(1000 * 1000 * 10, sbuff); System.out.println(sbuff); }
static public void main(String[] args) throws IOException { DiskCache.setRootDirectory("C:/temp/chill/"); make("C:/junk.txt"); make("C:/some/enchanted/evening/joots+3478.txt"); make("http://www.unidata.ucar.edu/some/enc hanted/eve'ning/nowrite.gibberish"); showCache(System.out); StringBuilder sbuff = new StringBuilder(); cleanCache(1000 * 1000 * 10, sbuff); System.out.println(sbuff); }