public class CmsVfsDiskCache
extends java.lang.Object
构造器和说明 |
---|
CmsVfsDiskCache(java.lang.String basepath,
java.lang.String foldername)
Creates a new disk cache.
|
限定符和类型 | 方法和说明 |
---|---|
byte[] |
getCacheContent(java.lang.String rfsName,
long dateLastModified)
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(boolean online,
java.lang.String rootPath,
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,
long dateLastModified)
Saves the given file content in the disk cache.
|
static java.io.File |
saveFile(java.lang.String rfsName,
byte[] content)
Saves the given file content to a RFS file of the given name (full path).
|
public CmsVfsDiskCache(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 folderpublic static java.io.File saveFile(java.lang.String rfsName, byte[] content) throws java.io.IOException
If the required parent folders do not exists, they are also created.
rfsName
- the RFS name of the file to save the content incontent
- the content of the file to savejava.io.IOException
- in case of disk access errorspublic byte[] getCacheContent(java.lang.String rfsName, long dateLastModified)
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 cachedateLastModified
- the date of last modification for the cachenull
public java.lang.String getCacheName(boolean online, java.lang.String rootPath, java.lang.String parameters)
online
- if true, the online disk cache is used, the offline disk cache otherwiserootPath
- the VFS resource root path to get the RFS cache name forparameters
- the parameters of the request to the VFS resourcepublic java.lang.String getRepositoryPath()
public void saveCacheFile(java.lang.String rfsName, byte[] content, long dateLastModified) throws java.io.IOException
rfsName
- the RFS name of the file to save the content incontent
- the content of the file to savedateLastModified
- the date of last modification to set for the save filejava.io.IOException
- in case of disk access errors