if ( cacheElement == null ) {
_logger.debug( "Dashboard render is not in cache." );
return null;
}
CdfRunJsDashboardWriteResult dashWrite = (CdfRunJsDashboardWriteResult) cacheElement.getValue();
// 3. Get the template file
String templPath = cacheKey.getTemplate();
// 4. Check if cache item has expired
// Cache is invalidated if the dashboard or template have changed since
// the cache was loaded, or at midnight every day,
// because of dynamic generation of date parameters.
Calendar cal = Calendar.getInstance();
cal.set( Calendar.HOUR_OF_DAY, 00 );
cal.set( Calendar.MINUTE, 00 );
cal.set( Calendar.SECOND, 1 );
// The date at which the source Dashboard object
// was loaded from disk, not the date at which the DashResult was written.
Date dashLoadedDate = dashWrite.getLoadedDate();
boolean cacheExpired = cal.getTime().after( dashLoadedDate );
if ( cacheExpired ) {
_logger.debug( "Cached dashboard render expired, re-rendering." );
return null;