public class ResourceCache
extends org.mortbay.component.AbstractLifeCycle
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
class |
ResourceCache.Content
MetaData associated with a context Resource.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
_cache |
protected int |
_cachedFiles |
protected int |
_cachedSize |
protected ResourceCache.Content |
_leastRecentlyUsed |
protected ResourceCache.Content |
_mostRecentlyUsed |
Constructor and Description |
---|
ResourceCache(MimeTypes mimeTypes)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
doStart() |
void |
doStop()
Stop the context.
|
protected void |
fill(ResourceCache.Content content) |
void |
flushCache() |
int |
getCachedFiles() |
int |
getCachedSize() |
int |
getMaxCachedFiles() |
int |
getMaxCachedFileSize() |
int |
getMaxCacheSize() |
ResourceCache.Content |
lookup(java.lang.String pathInContext,
Resource resource) |
ResourceCache.Content |
lookup(java.lang.String pathInContext,
ResourceFactory factory)
Get a Entry from the cache.
|
void |
setMaxCachedFiles(int maxCachedFiles) |
void |
setMaxCachedFileSize(int maxCachedFileSize) |
void |
setMaxCacheSize(int maxCacheSize) |
protected transient java.util.Map _cache
protected transient int _cachedSize
protected transient int _cachedFiles
protected transient ResourceCache.Content _mostRecentlyUsed
protected transient ResourceCache.Content _leastRecentlyUsed
public ResourceCache(MimeTypes mimeTypes)
public int getCachedSize()
public int getCachedFiles()
public int getMaxCachedFileSize()
public void setMaxCachedFileSize(int maxCachedFileSize)
public int getMaxCacheSize()
public void setMaxCacheSize(int maxCacheSize)
public int getMaxCachedFiles()
public void setMaxCachedFiles(int maxCachedFiles)
maxCachedFiles
- The maxCachedFiles to set.public void flushCache()
public ResourceCache.Content lookup(java.lang.String pathInContext, ResourceFactory factory) throws java.io.IOException
pathInContext
- The key into the cachefactory
- If no matching entry is found, this ResourceFactory
will be used to create the Resource
for the new enry that is created.pathInContext
, or a new entry if no matching entry was foundjava.io.IOException
public ResourceCache.Content lookup(java.lang.String pathInContext, Resource resource) throws java.io.IOException
java.io.IOException
public void doStart() throws java.lang.Exception
doStart
in class org.mortbay.component.AbstractLifeCycle
java.lang.Exception
public void doStop() throws java.lang.InterruptedException
doStop
in class org.mortbay.component.AbstractLifeCycle
java.lang.InterruptedException
protected void fill(ResourceCache.Content content) throws java.io.IOException
java.io.IOException
Copyright © 2009 Mortbay Consulting Pty. Ltd. All Rights Reserved.