public class DiskCache extends Object implements Cache
Cache
which optionally writes closed streams
to files on disk. This class has been tested on UNIX and Windows under
multi-threaded environments, and we see no reason why it shouldn't work
under other platforms as well. Here's a simple example:
Cache cache = new DiskCache(System.getProperty("java.io.tmpdir")+"/pdftemp.", 8192); PDF.setCache(cache);
PDF.setCache(org.faceless.pdf2.Cache)
Cache.Entry
Constructor and Description |
---|
DiskCache(String prefix,
int threshold)
Create a new DiskCache
|
Modifier and Type | Method and Description |
---|---|
Cache.Entry |
newEntry(int size)
Return a new Cache.Entry.
|
public DiskCache(String prefix, int threshold)
prefix
- The prefix to begin the cached filenames with. For instance, if
prefix was "/tmp/cache/mycache.", the cache files would be "/tmp/cache/mycache.NNN",
"/tmp/cache/mycache.NNN" etc. The fixed prefix of the filename will be lengthened to
at least 3 characters long if required.threshold
- the minimum number of bytes that are considered worth caching to
disk, or 0 to prevent caching altogetherpublic Cache.Entry newEntry(int size)
Cache
Copyright © 2001-2017 Big Faceless Organization