org.apache.cocoon.util
Class SoftSourceCache
java.lang.Object
org.apache.cocoon.util.SoftSourceCache
- All Implemented Interfaces:
- SourceCache
- public class SoftSourceCache
- extends Object
- implements SourceCache
Cache for objects created from a source. Objects and keys
are held using SoftReference
and are
thus cleanable by the garbage collector if the VM is low on
memory. If an object cannot be found in the cache or the
source's validity has expired, the source is reread and the
object is recreated using the registered
SourceReloader
.
- Since:
- 2.1.4
- Version:
- CVS $Id: SoftSourceCache.java 156626 2005-03-09 09:43:39Z cziegeler $
- Author:
- Christian Haul
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SoftSourceCache
public SoftSourceCache()
register
public void register(SourceReloader reloader)
- Description copied from interface:
SourceCache
- Register a source reloader that will recreate cached objects.
Often, this will be done using an anonymous nested class.
- Specified by:
register
in interface SourceCache
- Parameters:
reloader
-
getObject
public Object getObject(SourceResolver resolver,
Object key,
String uri,
Object parameter)
throws MalformedURLException,
IOException
- Description copied from interface:
SourceCache
- Retrieve an object from the cache. Transparently reloads and
recreates objects using the registered source reloader if the
objects identified by the key hasn't been cached or has been
cleared from the cache, or source has changed.
- Specified by:
getObject
in interface SourceCache
- Parameters:
resolver
- A source resolver to use.key
- An object used as a key to the cached object.uri
- A string holding the URI.parameter
- Parameters to pass to the source reloader.
- Returns:
- Cached object.
- Throws:
MalformedURLException
IOException
Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.