Package lumis.portal.page.cache
Interface IPageCacheManager
-
- All Known Subinterfaces:
IPageCacheManagerSPI
- All Known Implementing Classes:
PageCacheManager
public interface IPageCacheManager
Provides page cache operations.- Since:
- 4.0.0
- Version:
- $Revision: 20807 $ $Date: 2017-11-30 17:08:51 -0200 (Thu, 30 Nov 2017) $
- See Also:
lumis.portal.page.cache
-
-
Field Summary
Fields Modifier and Type Field Description static int
CLEAR_CACHE_CHANGE_TYPE_DELETE
static int
CLEAR_CACHE_CHANGE_TYPE_UPDATE
static int
PAGE_CACHE_GEN_STATE_DISABLED
static int
PAGE_CACHE_GEN_STATE_ENABLED
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
clearAllHTMLCache(ITransaction transaction)
Clears all page HTML cache.void
clearCacheByChannelIds(SessionConfig sessionConfig, Collection<String> channelIds, Map<String,String[]> parameters, int changeType, 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, 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.void
expirePageCache(PageCacheConfig pageCacheConfig)
Expires a singlePageCacheConfig
.PageCacheConfig
generatePage(String pageCacheId)
Generates a page cache.PageCacheConfig
get(String pageCacheId)
Returns a page cache given its identifier.int
getPageCacheGenerationState(SessionConfig sessionConfig, ITransaction transaction)
Deprecated.Since 5.0.0, replaced byisPageCacheGenerationEnabled()
for better performance and easier use.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.String
processHTMLForPageCache(String htmlContent, PageCacheConfig pageCache)
Processes a HTML code for storing for a page cache.default String
processHTMLForPageCache(String htmlContent, PageCacheConfig pageCache, boolean convertGuestOnlyCaches)
Deprecated.since 10.3.0 replaced byprocessHTMLForPageCache(String, PageCacheConfig)
.void
setPageCacheGenerationState(SessionConfig sessionConfig, int state, ITransaction transaction)
Sets the page cache generation statevoid
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.
-
-
-
Field Detail
-
PAGE_CACHE_GEN_STATE_ENABLED
static final int PAGE_CACHE_GEN_STATE_ENABLED
- See Also:
- Constant Field Values
-
PAGE_CACHE_GEN_STATE_DISABLED
static final int PAGE_CACHE_GEN_STATE_DISABLED
- See Also:
- Constant Field Values
-
CLEAR_CACHE_CHANGE_TYPE_UPDATE
static final int CLEAR_CACHE_CHANGE_TYPE_UPDATE
- See Also:
- Constant Field Values
-
CLEAR_CACHE_CHANGE_TYPE_DELETE
static final int CLEAR_CACHE_CHANGE_TYPE_DELETE
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
PageCacheConfig get(String pageCacheId) throws PortalException
Returns a page cache given its identifier.- Parameters:
pageCacheId
- the page cache identifier.- Returns:
- the persistent page cache instance.
- Throws:
PortalObjectNotFoundException
- if no page cache with the given identifier was found.PortalException
- Since:
- 5.0.0
-
delete
void delete(SessionConfig sessionConfig, String pageCacheId, ITransaction transaction) throws ManagerException, PortalException
Delete a page cache.- Parameters:
sessionConfig
-pageCacheId
-transaction
-- Throws:
ManagerException
PortalException
-
generatePage
PageCacheConfig generatePage(String pageCacheId) throws PortalException
Generates a page cache. If the generation lock could not be obtained, the page is not generated.- Parameters:
pageCacheId
- the page cache identifier.- Returns:
- the generated page cache information, or null if the generation lock could not be obtained.
- Throws:
PortalException
- Since:
- 4.1.0
-
clearCacheByPagesIds
void clearCacheByPagesIds(SessionConfig sessionConfig, Collection<String> pagesIds, Map<String,String[]> parameters, Locale locale, int changeType, ITransaction transaction) throws PortalException
Clear the cache of the specified pages. This method clears the specified pages cache after the transaction commits.- Parameters:
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.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 6.0.0
-
clearCacheByChannelIds
void clearCacheByChannelIds(SessionConfig sessionConfig, Collection<String> channelIds, Map<String,String[]> parameters, int changeType, ITransaction transaction) throws PortalException
Clear the cache of the pages within the specified channels recursively. This method will clear the specified pages cache after the transaction commits.- Parameters:
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.transaction
- the transaction for persistence access.pagesIds
- a collection of the pages identifiers.- Throws:
PortalException
- Since:
- 6.0.0
-
clearAllHTMLCache
void clearAllHTMLCache(ITransaction transaction) throws PortalException
Clears all page HTML cache.- Parameters:
transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 4.1.0
-
clearPageCacheErrors
void clearPageCacheErrors(Collection<String> pageCacheIds, ITransaction transaction) throws PortalException
Clear page cache errors in the database. It is locked for update before being updated.- Parameters:
pageCacheIds
- the page cache identifiers.transaction
- the transaction for persistence access.- Throws:
PortalException
- Since:
- 5.0.0
-
processHTMLForPageCache
@Deprecated default String processHTMLForPageCache(String htmlContent, PageCacheConfig pageCache, boolean convertGuestOnlyCaches) throws PortalException
Deprecated.since 10.3.0 replaced byprocessHTMLForPageCache(String, PageCacheConfig)
. From the version 10.3.0 on, the parameter convertGuestOnlyCaches is ignored.Processes a HTML code for storing for a page cache.- Parameters:
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.- Returns:
- the processed HTML code.
- Throws:
PortalException
- Since:
- 5.0.0
-
processHTMLForPageCache
String processHTMLForPageCache(String htmlContent, PageCacheConfig pageCache) throws PortalException
Processes a HTML code for storing for a page cache.- Parameters:
htmlContent
- HTML code.pageCache
- the page cache the code will be used in.- Returns:
- the processed HTML code.
- Throws:
PortalException
- Since:
- 10.3.0
-
expirePageCache
void expirePageCache(PageCacheConfig pageCacheConfig) throws PortalException
Expires a singlePageCacheConfig
.- Parameters:
pageCacheConfig
- the page cache to expired.- Throws:
PortalException
- Since:
- 6.1.0
-
getPageCacheGenerationState
@Deprecated int getPageCacheGenerationState(SessionConfig sessionConfig, ITransaction transaction) throws PortalException
Deprecated.Since 5.0.0, replaced byisPageCacheGenerationEnabled()
for better performance and easier use.Returns whether page cache generation is enabled or not- Parameters:
sessionConfig
-transaction
-- Returns:
- Throws:
PortalException
- Since:
- 4.0.11
-
isPageCacheGenerationEnabled
boolean isPageCacheGenerationEnabled()
Indicates if the page cache generation is globally enabled.- Returns:
true
if enabled,false
otherwise.- Since:
- 5.0.0
-
setPageCacheGenerationState
void setPageCacheGenerationState(SessionConfig sessionConfig, int state, ITransaction transaction) throws PortalException
Sets the page cache generation state- Parameters:
sessionConfig
-state
-transaction
-- Throws:
PortalException
- Since:
- 4.0.11
-
updateCachedFilesLastModifiedDate
void updateCachedFilesLastModifiedDate(SessionConfig sessionConfig, PageConfig pageConfig, Locale locale, Date lastModifiedDate, ITransaction transaction) throws PortalException
Updates the last modified date of the cached files that match the given pageId and locale.- Parameters:
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.- Throws:
PortalException
- Since:
- 4.0.11
-
waitForGeneration
String waitForGeneration(String pageCacheId, long timeout) throws PortalException, InterruptedException
Waits for the generation of a page cache.- Parameters:
pageCacheId
- the page cache identifier.timeout
- maximum time to wait.- Returns:
- the generated page content.
- Throws:
InterruptedException
- if the thread was interrupted.PortalException
- Since:
- 4.1.0
-
waitForPagesReadyToGenerate
void waitForPagesReadyToGenerate(long timeout, boolean forImmediateUseOnly) throws PortalException, InterruptedException
Waits for new pages to be ready to be generated.- Parameters:
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.- Throws:
InterruptedException
- if the thread was interrupted.PortalException
- Since:
- 4.1.0
-
pageCacheMissed
void pageCacheMissed(String pageCacheId, boolean forImmediateUse) throws PortalException
Indicates a miss in the page cache occurred. This provokes an asynchronous page cache generation and causes an increase in its priority due to the interest in accessing it.- Parameters:
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.- Throws:
IllegalStateException
- if the specified page cache cannot be generated due to its current state or the page cache framework's state.PortalException
- Since:
- 4.1.0
-
-