|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.cache.CmsVfsNameBasedDiskCache
Implements a name based RFS file based disk cache, that handles parameter based versions of VFS files, providing a cache for the "online" and another for the "offline" project.
This RFS cache operates on file names, plus a hashcode calculated from
CmsResource.getDateLastModified()
, CmsResource.getDateCreated()
and CmsResource.getLength()
. Optional parameters can be appended to this name,
which will be added as a second hashcode. This way a file can have multiple versions based on different parameters.
This cache should be usable for resources from the online AND the offline project at the same time, because any change to a resource will result in a changed hashcode. This means a resource changed in the offline project will have a new hashcode compared to the online project.
Constructor Summary | |
CmsVfsNameBasedDiskCache(java.lang.String basepath,
java.lang.String foldername)
Creates a new disk cache. |
Method Summary | |
byte[] |
getCacheContent(java.lang.String rfsName)
Returns the content of the requested file in the disk cache, or null if the
file is not found in the cache, or is found but outdated. |
java.lang.String |
getCacheName(CmsResource resource,
java.lang.String parameters)
Returns the RFS name to use for caching the given VFS resource with parameters in the disk cache. |
java.lang.String |
getRepositoryPath()
Returns the absolute path of the cache repository in the RFS. |
void |
saveCacheFile(java.lang.String rfsName,
byte[] content)
Saves the given file content in the disk cache. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CmsVfsNameBasedDiskCache(java.lang.String basepath, java.lang.String foldername)
basepath
- the base path for the cache in the RFSfoldername
- the folder name for this cache, to be used a subfolder for the base folderMethod Detail |
public byte[] getCacheContent(java.lang.String rfsName)
null
if the
file is not found in the cache, or is found but outdated.
rfsName
- the file RFS name to look up in the cache
null
public java.lang.String getCacheName(CmsResource resource, java.lang.String parameters)
resource
- the VFS resource to generate the cache name forparameters
- the parameters of the request to the VFS resource
public java.lang.String getRepositoryPath()
public void saveCacheFile(java.lang.String rfsName, byte[] content) throws java.io.IOException
rfsName
- the RFS name of the file to save the content incontent
- the content of the file to save
java.io.IOException
- in case of disk access errors
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |