pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.configuration
Class VFSFileCache

java.lang.Object
  extended by org.torweg.pulse.configuration.VFSFileCache

public final class VFSFileCache
extends java.lang.Object

a simple in memory cache for VirtualFiles used by PoorMansCache.

Version:
$Revision: 2061 $
Author:
Thomas Weber

Constructor Summary
protected VFSFileCache()
          creates a new VFSFileCache.
 
Method Summary
protected  java.io.InputStream cacheFile(VirtualFile f)
          caches the given virtual file.
protected  void cleanUp(TimeSpan maxInactive)
          cleans the cache (is called by PoorMansCache).
protected  java.io.InputStream getCached(VirtualFile f)
          checks whether the cache contains the given virtual file.
protected  long getCacheSize()
          returns the size of the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VFSFileCache

protected VFSFileCache()
creates a new VFSFileCache.

Method Detail

getCached

protected java.io.InputStream getCached(VirtualFile f)
checks whether the cache contains the given virtual file.

Parameters:
f - the file to check for
Returns:
the InputStream to the cached file or null, if the file is not cached

cacheFile

protected java.io.InputStream cacheFile(VirtualFile f)
                                 throws java.io.IOException
caches the given virtual file.

Parameters:
f - the file to be cached
Returns:
the InputStream
Throws:
java.io.IOException - on errors creating the entry

getCacheSize

protected long getCacheSize()
returns the size of the cache.

Returns:
the size

cleanUp

protected void cleanUp(TimeSpan maxInactive)
cleans the cache (is called by PoorMansCache).

Parameters:
maxInactive - the maximum inactivity timespan for cache entries