|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object lumis.portal.page.cache.PageCacheManager
public class PageCacheManager
Manager for page cache information.
Nested Class Summary | |
---|---|
protected static class |
PageCacheManager.HttpAccessResult
Structure used to hold the result of doHttpAccess(URL, String) . |
Nested classes/interfaces inherited from interface lumis.portal.page.cache.IPageCacheManager |
---|
IPageCacheManager.GenerationOutcome |
Field Summary | |
---|---|
static String |
PAGE_CACHE_MANAGER_LANGUAGE_FILENAME_PREFIX
|
Fields inherited from interface lumis.portal.page.cache.IPageCacheManager |
---|
CLEAR_CACHE_CHANGE_TYPE_DELETE, CLEAR_CACHE_CHANGE_TYPE_UPDATE, PAGE_CACHE_GEN_STATE_DISABLED, PAGE_CACHE_GEN_STATE_ENABLED |
Constructor Summary | |
---|---|
PageCacheManager()
|
Method Summary | |
---|---|
void |
clearAllHTMLCache(ITransaction transaction)
Clears all page HTML cache. |
void |
clearCacheByChannelIds(SessionConfig sessionConfig,
Collection<String> channelIds,
Map<String,String[]> parameters,
int changeType,
boolean clearImmediately,
ITransaction transaction)
Clear the cache of the pages within the specified channels recursively. |
void |
clearCacheByPagesIds(SessionConfig sessionConfig,
Collection<String> pagesIds,
Map<String,String[]> parameters,
Locale locale,
int changeType,
boolean clearImmediately,
ITransaction transaction)
Clear the cache of the specified pages. |
void |
clearPageCacheErrors(Collection<String> pageCacheIds,
ITransaction transaction)
Clear page cache errors in the database. |
void |
delete(SessionConfig sessionConfig,
String pageCacheId,
ITransaction transaction)
Delete a page cache. |
protected void |
deleteHtmlFiles(String filePath,
boolean deleteShadowCacheHtml)
Delete the HTML cache files for the specified path. |
protected PageCacheManager.HttpAccessResult |
doHttpAccess(URL url,
String cookies)
|
PageCacheConfig |
generateNextPage(boolean forImmediateUseOnly)
Generates next outdated page cache, according to its priority. |
protected void |
generatePage(PageCacheConfig pageCacheConfig)
|
PageCacheConfig |
generatePage(String pageCacheId)
Generates a page cache. |
PageCacheConfig |
get(String pageCacheId)
Returns a page cache given its identifier. |
protected PageCacheConfig |
getGenerationLock(String pageCacheId)
Gets a lock for generating a cached page. |
protected PageCacheConfig |
getNextPageForGeneration(boolean forImmediateUseOnly)
Returns the next page cache to be generated. |
int |
getPageCacheGenerationState(SessionConfig sessionConfig,
ITransaction transaction)
Deprecated. |
boolean |
isPageCacheGenerationEnabled()
Indicates if the page cache generation is globally enabled. |
void |
pageCacheMissed(String pageCacheId,
boolean forImmediateUse)
Indicates a miss in the page cache occurred. |
void |
pageCacheMissedByFilePath(String filePath,
boolean forImmediateUse)
Indicates a miss in the page cache occurred. |
String |
processHTMLForPageCache(String htmlContent,
PageCacheConfig pageCache,
boolean convertGuestOnlyCaches)
Processes a HTML code for storing for a page cache. |
protected void |
releaseGenerationLock(PageCacheConfig pageCacheConfig,
IPageCacheManager.GenerationOutcome outcome)
Releases the generation lock for a cached page. |
void |
setPageCacheGenerationState(SessionConfig sessionConfig,
int state,
ITransaction transaction)
Sets the page cache generation state. |
void |
updateCachedFilesLastModifiedDate(SessionConfig sessionConfig,
PageConfig pageConfig,
Locale locale,
Date lastModifiedDate,
ITransaction transaction)
Updates the last modified date of the cached files that match the given pageId and locale. |
String |
waitForGeneration(String pageCacheId,
long timeout)
Waits for the generation of a page cache. |
void |
waitForPagesReadyToGenerate(long timeout,
boolean forImmediateUseOnly)
Waits for new pages to be ready to be generated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PAGE_CACHE_MANAGER_LANGUAGE_FILENAME_PREFIX
Constructor Detail |
---|
public PageCacheManager()
Method Detail |
---|
public String waitForGeneration(String pageCacheId, long timeout) throws PortalException, InterruptedException
IPageCacheManager
waitForGeneration
in interface IPageCacheManager
pageCacheId
- the page cache identifier.timeout
- maximum time to wait.
InterruptedException
- if the thread was interrupted.
PortalException
public void waitForPagesReadyToGenerate(long timeout, boolean forImmediateUseOnly) throws InterruptedException
IPageCacheManager
waitForPagesReadyToGenerate
in interface IPageCacheManager
timeout
- maximum time to wait.forImmediateUseOnly
- if true, wait until a page for
immediate use is ready to generate. If false, wait until any page is
ready to generate.
InterruptedException
- if the thread was interrupted.protected PageCacheManager.HttpAccessResult doHttpAccess(URL url, String cookies) throws UnsupportedEncodingException, IOException
UnsupportedEncodingException
IOException
protected void generatePage(PageCacheConfig pageCacheConfig) throws ManagerException, PortalException
ManagerException
PortalException
public PageCacheConfig generateNextPage(boolean forImmediateUseOnly) throws PortalException
IPageCacheManager
generateNextPage
in interface IPageCacheManager
forImmediateUseOnly
- if true, only pages whose priority is higher
than PageCacheConfig.MAX_INITIAL_PRIORITY
are taken in account.
PortalException
public PageCacheConfig generatePage(String pageCacheId) throws PortalException
IPageCacheManager
generatePage
in interface IPageCacheManager
pageCacheId
- the page cache identifier.
PortalException
protected void deleteHtmlFiles(String filePath, boolean deleteShadowCacheHtml)
filePath
- the relative cache file path.deleteShadowCacheHtml
- if true
, the shadow cache file
is also deleted.public void delete(SessionConfig sessionConfig, String pageCacheId, ITransaction transaction) throws ManagerException, PortalException
IPageCacheManager
delete
in interface IPageCacheManager
ManagerException
PortalException
public PageCacheConfig get(String pageCacheId) throws PortalException
IPageCacheManager
get
in interface IPageCacheManager
pageCacheId
- the page cache identifier.
PortalObjectNotFoundException
- if no page cache with the given
identifier was found.
PortalException
public String processHTMLForPageCache(String htmlContent, PageCacheConfig pageCache, boolean convertGuestOnlyCaches) throws PortalException
IPageCacheManager
processHTMLForPageCache
in interface IPageCacheManager
htmlContent
- HTML code.pageCache
- the page cache the code will be used in.convertGuestOnlyCaches
- if true, pages with cache enabled only for
guest will also have their dynamic paths converted.
PortalException
public void clearCacheByPagesIds(SessionConfig sessionConfig, Collection<String> pagesIds, Map<String,String[]> parameters, Locale locale, int changeType, boolean clearImmediately, ITransaction transaction) throws PortalException
IPageCacheManager
clearImmediately
is set to true
,
it will also clear the specified pages cache immediately, synchronously.
clearCacheByPagesIds
in interface IPageCacheManager
sessionConfig
- the user session information.pagesIds
- a collection of the pages identifiers.parameters
- the page parameters. Used to filter which caches
are cleared.locale
- specifies the locale to which the cache clearing is to
be applied. May be null to indicate any locale.changeType
- the cause of the cache clear. Must be one of the
CLEAR_CACHE_CHANGE_TYPE_* constants.clearImmediately
- if the cache clearing is also to be executed
immediately.transaction
- the transaction for persistence access.
PortalException
public void clearCacheByChannelIds(SessionConfig sessionConfig, Collection<String> channelIds, Map<String,String[]> parameters, int changeType, boolean clearImmediately, ITransaction transaction) throws PortalException
IPageCacheManager
clearImmediately
is set to true
,
it will also clear the specified pages cache immediately, synchronously.
clearCacheByChannelIds
in interface IPageCacheManager
sessionConfig
- the user session information.parameters
- the page parameters. Used to filter which caches
are cleared.changeType
- the cause of the cache clear. Must be one of the
CLEAR_CACHE_CHANGE_TYPE_* constants.clearImmediately
- if the cache clearing is also to be executed
immediately.transaction
- the transaction for persistence access.
PortalException
@Deprecated public int getPageCacheGenerationState(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
IPageCacheManager
getPageCacheGenerationState
in interface IPageCacheManager
PortalException
public boolean isPageCacheGenerationEnabled()
IPageCacheManager
isPageCacheGenerationEnabled
in interface IPageCacheManager
true
if enabled, false
otherwise.public void setPageCacheGenerationState(SessionConfig sessionConfig, int state, ITransaction transaction) throws PortalException
The session provided must have MANAGE_CACHE permission at the portal level in order to execute this method successfully.
setPageCacheGenerationState
in interface IPageCacheManager
sessionConfig
- state
- transaction
-
PortalException
protected PageCacheConfig getGenerationLock(String pageCacheId) throws PortalException
To get a lock successfully, the page cache status must be PageCacheConfig.STATUS_OUTDATED
.
If successful, the page cache status will be changed to PageCacheConfig.STATUS_GENERATING
.
pageCacheId
- the page cache identifier.
PortalException
protected void releaseGenerationLock(PageCacheConfig pageCacheConfig, IPageCacheManager.GenerationOutcome outcome) throws PortalException
According to the outcome argument, the following happens:
GenerationOutcome#SUCCESS
: If the current status is
generating
, it is changed to
updated
, else it is changed to
outdated
. The
number of errors
is reset
to zero.GenerationOutcome#CANCEL
: The status is changed to
outdated
.GenerationOutcome#ERROR
: The
number of errors
is incremented, and the status is changed to
outdated
or
outdated with error
,
depending on whether the number of errors reached
max error count
.
pageCacheConfig
- the page cache.outcome
- the generation outcome.newStatus
- the new status if the current status is generating.
PortalException
public void updateCachedFilesLastModifiedDate(SessionConfig sessionConfig, PageConfig pageConfig, Locale locale, Date lastModifiedDate, ITransaction transaction) throws PortalException
IPageCacheManager
updateCachedFilesLastModifiedDate
in interface IPageCacheManager
sessionConfig
- the user session information.pageConfig
- the portal page.locale
- locale for which the cached files needs to be modified.lastModifiedDate
- date to which the matched files must be modified to.transaction
- the transaction for persistence access.
PortalException
public void pageCacheMissed(String pageCacheId, boolean forImmediateUse) throws PortalException
IPageCacheManager
pageCacheMissed
in interface IPageCacheManager
pageCacheId
- the page cache identifier.forImmediateUse
- if true, indicates that the missed page cache
is required for immediate use. This will greater boost the priority to
generate the corresponding page cache.
PortalException
public void pageCacheMissedByFilePath(String filePath, boolean forImmediateUse) throws PortalException
IPageCacheManager
pageCacheMissedByFilePath
in interface IPageCacheManager
forImmediateUse
- if true, indicates that the missed page cache
is required for immediate use. This will greater boost the priority to
generate the corresponding page cache.
PortalObjectNotFoundException
- if no page cache for the specified
file path was found.
PortalException
protected PageCacheConfig getNextPageForGeneration(boolean forImmediateUseOnly) throws PortalException
forImmediateUseOnly
- if true, only pages whose priority is higher
than PageCacheConfig.MAX_INITIAL_PRIORITY
are taken in account.
PortalException
#getGenerationLock(PageCacheConfig)
,
#releaseGenerationLock(PageCacheConfig, int)
public void clearAllHTMLCache(ITransaction transaction) throws PortalException
IPageCacheManager
clearAllHTMLCache
in interface IPageCacheManager
transaction
- the transaction for persistence access.
PortalException
public void clearPageCacheErrors(Collection<String> pageCacheIds, ITransaction transaction) throws PortalException
IPageCacheManager
clearPageCacheErrors
in interface IPageCacheManager
pageCacheIds
- the page cache identifiers.transaction
- the transaction for persistence access.
PortalException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |