if( m_documentCache != null )
{
try
{
WikiDocument doc = (WikiDocument) m_documentCache.getFromCache( pageid,
m_cacheExpiryPeriod );
wasUpdated = true;
//
// This check is needed in case the different filters have actually
// changed the page data.
// FIXME: Figure out a faster method
if( pagedata.equals(doc.getPageData()) )
{
if( log.isDebugEnabled() ) log.debug("Using cached HTML for page "+pageid );
return doc;
}
}
catch( NeedsRefreshException e )
{
if( log.isDebugEnabled() ) log.debug("Re-rendering and storing "+pageid );
}
}
//
// Refresh the data content
//
try
{
MarkupParser parser = getParser( context, pagedata );
WikiDocument doc = parser.parse();
doc.setPageData( pagedata );
if( m_documentCache != null )
{
m_documentCache.putInCache( pageid, doc );
wasUpdated = true;
}