public class CmsFormatterConfigurationCache extends java.lang.Object implements I_CmsGlobalConfigurationCache
This class does not immediately update the cached formatter collection when changes in the VFS occur, but instead schedules an update action with a slight delay, so that if many formatters are changed in a short time, only one update operation is needed.
Two instances of this cache are needed, one for the Online project and one for Offline projects.
限定符和类型 | 字段和说明 |
---|---|
static CmsUUID |
RELOAD_MARKER
A UUID which is used to mark the configuration cache for complete reloading.
|
static java.lang.String |
TYPE_FORMATTER_CONFIG
The resource type for formatter configurations.
|
protected static int |
UPDATE_DELAY_SECONDS
The delay to use for updating the formatter cache, in seconds.
|
构造器和说明 |
---|
CmsFormatterConfigurationCache(CmsObject cms,
java.lang.String name)
Creates a new formatter configuration cache instance.
|
限定符和类型 | 方法和说明 |
---|---|
void |
clear()
Clears the cache.
|
java.lang.String |
getName()
Gets the cache instance name.
|
CmsFormatterConfigurationCacheState |
getState()
Gets the collection of cached formatters.
|
void |
performUpdate()
The method called by the scheduled update action to update the cache.
|
protected CmsFormatterBean |
readFormatter(CmsUUID structureId)
Reads a formatter given its structure id and returns it, or null if the formatter couldn't be read.
|
void |
reload()
Reloads the formatter cache.
|
void |
remove(CmsPublishedResource pubRes)
Removes a published resource from the cache.
|
void |
remove(CmsResource resource)
Removes a resource from the cache.
|
void |
update(CmsPublishedResource pubRes)
Updates the cache entry for the given published resource.
|
void |
update(CmsResource resource)
Updates the cache entry for the given resource.
|
void |
waitForUpdate()
Waits until no update action is scheduled.
|
public static final CmsUUID RELOAD_MARKER
public static final java.lang.String TYPE_FORMATTER_CONFIG
protected static int UPDATE_DELAY_SECONDS
public CmsFormatterConfigurationCache(CmsObject cms, java.lang.String name) throws CmsException
cms
- the CMS context to usename
- the cache nameCmsException
- if something goes wrongpublic void clear()
I_CmsGlobalConfigurationCache
public java.lang.String getName()
public CmsFormatterConfigurationCacheState getState()
public void performUpdate()
public void reload()
public void remove(CmsPublishedResource pubRes)
I_CmsGlobalConfigurationCache
remove
在接口中 I_CmsGlobalConfigurationCache
pubRes
- the published resourceI_CmsGlobalConfigurationCache.remove(org.opencms.db.CmsPublishedResource)
public void remove(CmsResource resource)
I_CmsGlobalConfigurationCache
remove
在接口中 I_CmsGlobalConfigurationCache
resource
- the resource to removeI_CmsGlobalConfigurationCache.remove(org.opencms.file.CmsResource)
public void update(CmsPublishedResource pubRes)
I_CmsGlobalConfigurationCache
NOTE: Cache implementations should not directly read the updated resource in this method because it might interfere with other caches. Instead, the resource should be marked as updated and read the next time the cache is queried.
update
在接口中 I_CmsGlobalConfigurationCache
pubRes
- a published resourceI_CmsGlobalConfigurationCache.update(org.opencms.db.CmsPublishedResource)
public void update(CmsResource resource)
I_CmsGlobalConfigurationCache
NOTE: Cache implementations should not directly read the updated resource in this method because it might interfere with other caches. Instead, the resource should be marked as updated and read the next time the cache is queried.
update
在接口中 I_CmsGlobalConfigurationCache
resource
- the resource for which the cache entry should be updatedI_CmsGlobalConfigurationCache.update(org.opencms.file.CmsResource)
public void waitForUpdate()
Should only be used in tests.
protected CmsFormatterBean readFormatter(CmsUUID structureId)
structureId
- the structure id of the formatter configuration