public final class CacheHelper extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CacheHelper.InvalidateCacheTimerTask
TimerTask to invalidate site cache |
Modifier and Type | Field and Description |
---|---|
private static Map<String,Long> |
_cacheForPeriodOfValidity |
(package private) static Map<String,Long> |
_lastInvalidationDate |
(package private) static Integer |
_lockToken |
(package private) static Timer |
_timer |
(package private) static Map<String,String> |
_timerTasks |
Modifier | Constructor and Description |
---|---|
private |
CacheHelper() |
Modifier and Type | Method and Description |
---|---|
private static boolean |
_checkResponse(byte[] bodyResponse) |
private static String |
_getContentType(org.apache.http.HttpResponse invalidateResponse) |
private static long |
_getPeriodOfValidity(Site site,
String siteName) |
private static byte[] |
_getResponse(org.apache.http.HttpResponse response) |
static List<Map<String,Object>> |
callWS(String url,
List<org.apache.http.NameValuePair> postParameters,
Logger logger)
Request the given URL on each configured front-office.
|
static List<Map<String,Object>> |
callWS(String url,
Logger logger)
Request the given URL on each configured front-office.
|
static void |
delayCacheInvalidation(String siteName,
String urlWS,
long periodOfValidity,
Logger logger)
Delay the cache invalidation
|
static void |
initializeTimerPeriod(String siteName)
Update the last invalidation cache
|
static 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 site
|
static void |
testWS(String url,
List<org.apache.http.NameValuePair> postParameters,
Logger logger)
Request the given URL on each configured front-office.
|
static void |
testWS(String url,
Logger logger)
Request the given URL on each configured front-office.
|
static Integer _lockToken
static Map<String,Long> _lastInvalidationDate
static Map<String,String> _timerTasks
private static Map<String,Long> _cacheForPeriodOfValidity
private CacheHelper()
public static void testWS(String url, Logger logger) throws Exception
url
- the url to be called.logger
- logger for traces.Exception
- if an error occurred.public static void testWS(String url, List<org.apache.http.NameValuePair> postParameters, Logger logger) throws Exception
url
- the url to be called.postParameters
- submited valueslogger
- logger for traces.Exception
- if an error occurred.public static List<Map<String,Object>> callWS(String url, Logger logger) throws Exception
url
- the url to be called.logger
- logger for traces.Exception
- if an error occurred.public static List<Map<String,Object>> callWS(String url, List<org.apache.http.NameValuePair> postParameters, Logger logger) throws Exception
url
- the url to be called.postParameters
- submitted valueslogger
- logger for traces.Exception
- if an error occurred.private static boolean _checkResponse(byte[] bodyResponse) throws ParserConfigurationException, IllegalStateException, IOException, SAXException, TransformerException
private static byte[] _getResponse(org.apache.http.HttpResponse response) throws IllegalStateException, IOException
IllegalStateException
IOException
private static String _getContentType(org.apache.http.HttpResponse invalidateResponse)
public static void invalidateCache(Site site, Logger logger) throws Exception
site
- the site.logger
- logger for traces.Exception
- if an error occurs.public static void invalidateCache(Sitemap sitemap, Logger logger) throws Exception
sitemap
- the sitemap.logger
- logger for traces.Exception
- if an error occurs.public static void invalidateCache(Page page, Logger logger, boolean recursively) throws Exception
page
- the page.logger
- logger for traces.recursively
- true to invalidate the sub-pagesException
- if an error occurs.public static void invalidateCache(Page page, Logger logger) throws Exception
page
- the page.logger
- logger for traces.Exception
- if an error occurs.private static long _getPeriodOfValidity(Site site, String siteName)
public static void initializeTimerPeriod(String siteName)
siteName
- the site namepublic static boolean isCacheValidityExpired(String siteName, long periodOfValidity)
siteName
- the site nameperiodOfValidity
- the period of cache validitypublic static void delayCacheInvalidation(String siteName, String urlWS, long periodOfValidity, Logger logger)
siteName
- the site nameurlWS
- the WS url to be calledperiodOfValidity
- the period of cache validitylogger
- the logger