Package org.ametys.web.cache
Class CacheHelper
java.lang.Object
org.ametys.web.cache.CacheHelper
Helper for dealing with front-office cache.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionRequest the given URL on each configured front-office.Request the given URL on each configured front-office.static void
delayCacheInvalidation
(String siteName, String urlWS, long periodOfValidity, Logger logger) Delay the cache invalidationstatic String[]
Get front office applications urlsstatic void
initializeTimerPeriod
(String siteName) Update the last invalidation cachestatic void
invalidateCache
(Page page, Logger logger) Invalidates the front-office from the event observed.static void
invalidateCache
(Page page, Logger logger, boolean recursively) Invalidates the front-office from the event observed.static void
invalidateCache
(Site site, Logger logger) Invalidates the front-office from the event observed.static void
invalidateCache
(Sitemap sitemap, Logger logger) Invalidates the front-office from the event observed.static boolean
isCacheValidityExpired
(String siteName, long periodOfValidity) Determines if cache validity is expired for given sitestatic void
Request the given URL on each configured front-office.static void
Request the given URL on each configured front-office.
-
Method Details
-
testWS
Request the given URL on each configured front-office.- Parameters:
url
- the url to be called.logger
- logger for traces.- Throws:
Exception
- if an error occurred.
-
testWS
public static void testWS(String url, List<org.apache.http.NameValuePair> postParameters, Logger logger) throws Exception Request the given URL on each configured front-office.- Parameters:
url
- the url to be called.postParameters
- submited valueslogger
- logger for traces.- Throws:
Exception
- if an error occurred.
-
callWS
Request the given URL on each configured front-office.- Parameters:
url
- the url to be called.logger
- logger for traces.- Returns:
- The streams
- Throws:
Exception
- if an error occurred.
-
getFrontURLS
Get front office applications urls- Returns:
- The non null list of url configured. Can be empty.
-
callWS
public static List<Map<String,Object>> callWS(String url, List<org.apache.http.NameValuePair> postParameters, Logger logger) throws Exception Request the given URL on each configured front-office.- Parameters:
url
- the url to be called.postParameters
- submitted valueslogger
- logger for traces.- Returns:
- The streams
- Throws:
Exception
- if an error occurred.
-
invalidateCache
Invalidates the front-office from the event observed.- Parameters:
site
- the site.logger
- logger for traces.- Throws:
Exception
- if an error occurs.
-
invalidateCache
Invalidates the front-office from the event observed.- Parameters:
sitemap
- the sitemap.logger
- logger for traces.- Throws:
Exception
- if an error occurs.
-
invalidateCache
Invalidates the front-office from the event observed.- Parameters:
page
- the page.logger
- logger for traces.recursively
- true to invalidate the sub-pages- Throws:
Exception
- if an error occurs.
-
invalidateCache
Invalidates the front-office from the event observed.- Parameters:
page
- the page.logger
- logger for traces.- Throws:
Exception
- if an error occurs.
-
initializeTimerPeriod
Update the last invalidation cache- Parameters:
siteName
- the site name
-
isCacheValidityExpired
Determines if cache validity is expired for given site- Parameters:
siteName
- the site nameperiodOfValidity
- the period of cache validity- Returns:
- true if cache validity is expired
-
delayCacheInvalidation
public static void delayCacheInvalidation(String siteName, String urlWS, long periodOfValidity, Logger logger) Delay the cache invalidation- Parameters:
siteName
- the site nameurlWS
- the WS url to be calledperiodOfValidity
- the period of cache validitylogger
- the logger
-