public class ResourceCache extends Object implements HttpContent.Factory
Modifier and Type | Class and Description |
---|---|
class |
ResourceCache.CachedGzipHttpContent |
class |
ResourceCache.CachedHttpContent
MetaData associated with a context Resource.
|
Constructor and Description |
---|
ResourceCache(ResourceCache parent,
ResourceFactory factory,
MimeTypes mimeTypes,
boolean useFileMappedBuffer,
boolean etags,
boolean gzip)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
flushCache() |
int |
getCachedFiles() |
int |
getCachedSize() |
HttpContent |
getContent(String pathInContext,
int maxBufferSize)
Get a Entry from the cache.
|
protected ByteBuffer |
getDirectBuffer(Resource resource) |
protected ByteBuffer |
getIndirectBuffer(Resource resource) |
int |
getMaxCachedFiles() |
int |
getMaxCachedFileSize() |
int |
getMaxCacheSize() |
protected boolean |
isCacheable(Resource resource) |
boolean |
isUseFileMappedBuffer() |
HttpContent |
lookup(String pathInContext)
Deprecated.
|
void |
setMaxCachedFiles(int maxCachedFiles) |
void |
setMaxCachedFileSize(int maxCachedFileSize) |
void |
setMaxCacheSize(int maxCacheSize) |
String |
toString() |
public ResourceCache(ResourceCache parent, ResourceFactory factory, MimeTypes mimeTypes, boolean useFileMappedBuffer, boolean etags, boolean gzip)
parent
- the parent resource cachefactory
- the resource factorymimeTypes
- Mimetype to use for meta datauseFileMappedBuffer
- true to file memory mapped buffersetags
- true to support etagsgzip
- true to support gzippublic 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 boolean isUseFileMappedBuffer()
public void flushCache()
@Deprecated public HttpContent lookup(String pathInContext) throws IOException
IOException
public HttpContent getContent(String pathInContext, int maxBufferSize) throws IOException
getContent
in interface HttpContent.Factory
pathInContext
- The key into the cachemaxBufferSize
- The maximum buffer to allocated for this request. For cached content, a larger buffer may have
previously been allocated and returned by the HttpContent.getDirectBuffer()
or HttpContent.getIndirectBuffer()
calls.pathInContext
, or a new entry
if no matching entry was found. If the content exists but is not cachable,
then a ResourceHttpContent
instance is return. If
the resource does not exist, then null is returned.IOException
- Problem loading the resourceprotected boolean isCacheable(Resource resource)
resource
- the resource to testprotected ByteBuffer getIndirectBuffer(Resource resource)
protected ByteBuffer getDirectBuffer(Resource resource)
Copyright © 1995-2016 Webtide. All Rights Reserved.