to.etc.domui.caches.filecache
Class FileCache

java.lang.Object
  extended by to.etc.domui.caches.filecache.FileCache

public class FileCache
extends java.lang.Object

The file area cache used by the image code. This maintains the file cache and cleans it out every once in a while. To ensure safe access all files in the cache must be retrieved through this file cache, and after use these need to be released. This ensures that no files are removed that are currently in use.

Author:
Frits Jalvingh Created on Nov 30, 2009

Constructor Summary
FileCache(java.io.File cacheRoot, long maxFileSize)
           
 
Method Summary
 FileCacheRef getFile(java.lang.String rpath)
           
 void initialize()
           
 void reaper()
          Called every once in a while to clean out the file cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileCache

public FileCache(java.io.File cacheRoot,
                 long maxFileSize)
Method Detail

initialize

public void initialize()
                throws java.lang.Exception
Throws:
java.lang.Exception

getFile

public FileCacheRef getFile(java.lang.String rpath)

reaper

public void reaper()
Called every once in a while to clean out the file cache. This walks the entire cache directory and determines it's current size; it also collects the oldest files in that cache into a reap list. If the size of the cache is above it's max size then files on the reap list are deleted until the cache reaches an allowed size.