org.eclipse.jetty.server
Class ResourceCache

java.lang.Object
  extended by org.eclipse.jetty.server.ResourceCache

public class ResourceCache
extends Object


Nested Class Summary
 class ResourceCache.Content
          MetaData associated with a context Resource.
 
Constructor Summary
ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes, boolean fileMappedBuffers)
          Constructor.
 
Method Summary
 void flushCache()
           
 int getCachedFiles()
           
 int getCachedSize()
           
protected  Buffer getDirectBuffer(Resource resource)
           
protected  Buffer getIndirectBuffer(Resource resource)
           
 int getMaxCachedFiles()
           
 int getMaxCachedFileSize()
           
 int getMaxCacheSize()
           
protected  boolean isCacheable(Resource resource)
           
 HttpContent lookup(String pathInContext)
          Get a Entry from the cache.
 void setMaxCachedFiles(int maxCachedFiles)
           
 void setMaxCachedFileSize(int maxCachedFileSize)
           
 void setMaxCacheSize(int maxCacheSize)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceCache

public ResourceCache(ResourceCache parent,
                     ResourceFactory factory,
                     MimeTypes mimeTypes,
                     boolean fileMappedBuffers)
Constructor.

Parameters:
mimeTypes - Mimetype to use for meta data
fileMappedBuffers - True if file mapped buffers can be used for DirectBuffers
Method Detail

getCachedSize

public int getCachedSize()

getCachedFiles

public int getCachedFiles()

getMaxCachedFileSize

public int getMaxCachedFileSize()

setMaxCachedFileSize

public void setMaxCachedFileSize(int maxCachedFileSize)

getMaxCacheSize

public int getMaxCacheSize()

setMaxCacheSize

public void setMaxCacheSize(int maxCacheSize)

getMaxCachedFiles

public int getMaxCachedFiles()
Returns:
Returns the maxCachedFiles.

setMaxCachedFiles

public void setMaxCachedFiles(int maxCachedFiles)
Parameters:
maxCachedFiles - The maxCachedFiles to set.

flushCache

public void flushCache()

lookup

public HttpContent lookup(String pathInContext)
                   throws IOException
Get a Entry from the cache. Get either a valid entry object or create a new one if possible.

Parameters:
pathInContext - The key into the cache
Returns:
The entry matching pathInContext, or a new entry if no matching entry was found. If the content exists but is not cachable, then a HttpContent.ResourceAsHttpContent instance is return. If the resource does not exist, then null is returned.
Throws:
IOException - Problem loading the resource

isCacheable

protected boolean isCacheable(Resource resource)
Parameters:
resource -
Returns:
True if the resource is cacheable. The default implementation tests the cache sizes.

getIndirectBuffer

protected Buffer getIndirectBuffer(Resource resource)

getDirectBuffer

protected Buffer getDirectBuffer(Resource resource)


Copyright © 1995-2010 Mort Bay Consulting. All Rights Reserved.