|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.search.documents.CmsExtractionResultCache
public class CmsExtractionResultCache
Implements a disk cache that stores text extraction results in the RFS.
This cache operates on resource file names, plus a hashcode calculated from
CmsResource.getDateLastModified()
and CmsResource.getLength()
. Optional a locale can be appended to this name.
Since text extraction is done only on the content of a resource, all siblings must have the same content. The difference can be only by the locale setting in case of an XML content or XML page. However, the most problematic contents to extract for the search are in fact the MS Office and PDF formats. For these documents, all siblings must produce the exact same text extraction result.
This cache is 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. If the resource is identical in the online and the offline project, the generated hashcodes will be the same.
Constructor Summary | |
---|---|
CmsExtractionResultCache(java.lang.String basepath,
java.lang.String foldername)
Creates a new disk cache. |
Method Summary | |
---|---|
int |
cleanCache(float maxAge)
Removes all expired extraction result cache entries from the RFS cache. |
java.lang.String |
getCacheName(CmsResource resource,
java.util.Locale locale)
Returns the RFS name used for caching an the text extraction result based on the given VFS resource and locale. |
java.lang.Object |
getCacheObject(java.lang.String rfsName)
Returns the object stored in 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 |
getRepositoryPath()
Returns the absolute path of the cache repository in the RFS. |
void |
saveCacheObject(java.lang.String rfsName,
java.lang.Object object)
Serializes the given object and saves it 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 CmsExtractionResultCache(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 int cleanCache(float maxAge)
maxAge
- the maximum age of the extraction result cache files in hours (or fractions of hours)
public java.lang.String getCacheName(CmsResource resource, java.util.Locale locale)
resource
- the VFS resource to generate the cache name forlocale
- the locale to generate the cache name for (may be null
)
public java.lang.Object getCacheObject(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 getRepositoryPath()
public void saveCacheObject(java.lang.String rfsName, java.lang.Object object) throws java.io.IOException
rfsName
- the RFS name of the file to save the object inobject
- the object to serialize and 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 |