/** * Creates a new SimpleDirectoryPersistentCache Object. Make sure that the * cacheDir exists and that it's an directory. * * If your cacheDir is case insensitive then make sure to set the * StringEncoder to {@link Base32Encoder} (which is the default). * * @param cacheDir The directory where the cache will be stored. * @param filenameEncoder Encodes the node string into a filename. */ public SimpleDirectoryPersistentCache(File cacheDir, StringEncoder filenameEncoder) { if (!cacheDir.exists()) throw new IllegalStateException("Cache directory \"" + cacheDir + "\" does not exist"); if (!cacheDir.isDirectory()) throw new IllegalStateException("Cache directory \"" + cacheDir + "\" is not a directory"); this.cacheDir = cacheDir; this.filenameEncoder = filenameEncoder; }