[bd] Cache [Deleted]

Many things can affect the rendering of thread like lock/unlock etc., not just post edit/new post. Sometimes add-on makes change to thread too. That's why it is risky.

So I modified it to cache all pages of a thread by forcing _bdCache_isSafeToCache to return true, and hooking up bdCache_XenForo_DataWriter_DiscussionMessage_Post like:
PHP:
class bdCache_XenForo_DataWriter_DiscussionMessage_Post extends XFCP_bdCache_XenForo_DataWriter_DiscussionMessage_Post
{
  public function save(){
  $response = parent::save();
               if (!empty($_REQUEST['_xfRelativeResolver']))
                    bdCache_Core::getInstance()->purgeCache($_REQUEST['_xfRelativeResolver']);
                if (!empty($_SERVER['HTTP_REFERER']))
                    bdCache_Core::getInstance()->purgeCache($_SERVER['HTTP_REFERER']);
        return $response;
    }
}

Seems to work. Flushes as expected.
 
Is the 'Purge Cache' and 'CacheTTL: Default' links also available in AdminCP? Because I don't like them being in my moderator_bar.
 
Error Info
XenForo_Exception: bdCache_Core::_getRequestUriSignature() is called before session is setup - library/bdCache/Core.php:310
Generated By: Unknown Account, 56 minutes ago

Stack Trace
#0 /library/bdCache/Core.php(295): bdCache_Core->_getRequestUriSignature('https://www.phc...', Array)
#1 /library/bdCache/XenForo/DataWriter/DiscussionMessage/Post.php(15): bdCache_Core->purgeCache('https://www.phc...')
#2 /library/XenForo/DataWriter.php(1411): bdCache_XenForo_DataWriter_DiscussionMessage_Post->_postSaveAfterTransaction()
#3 /library/Dark/TaigaChat/DataWriter/DiscussionMessage/Post.php(7): XenForo_DataWriter->save()
#4 /library/Dark/TaigaChat/CronEntry/CleanUp.php(67): Dark_TaigaChat_DataWriter_DiscussionMessage_Post->save()
#5 [internal function]: Dark_TaigaChat_CronEntry_CleanUp::runDailyCleanUp(Array)
#6 /library/XenForo/Model/Cron.php(356): call_user_func(Array, Array)
#7 /library/XenForo/Deferred/Cron.php(24): XenForo_Model_Cron->runEntry(Array)
#8 /library/XenForo/Model/Deferred.php(256): XenForo_Deferred_Cron->execute(Array, Array, 7.9999990463257, '')
#9 /library/XenForo/Model/Deferred.php(390): XenForo_Model_Deferred->runDeferred(Array, 7.9999990463257, '', false)
#10 /library/XenForo/Model/Deferred.php(335): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#11 /deferred.php(23): XenForo_Model_Deferred->run(false)
#12 {main}

Request State
array(3) {
["url"] => string(37) "https://www.phcorner.net/deferred.php"
["_GET"] => array(0) {
}
["_POST"] => array(4) {
["_xfRequestUri"] => string(28) "/find-new/88455/posts?page=5"
["_xfNoRedirect"] => string(1) "1"
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"
}
}
 
Is the 'Purge Cache' and 'CacheTTL: Default' links also available in AdminCP? Because I don't like them being in my moderator_bar.
No.

Error Info
XenForo_Exception: bdCache_Core::_getRequestUriSignature() is called before session is setup - library/bdCache/Core.php:310
Generated By: Unknown Account, 56 minutes ago

Stack Trace
#0 /library/bdCache/Core.php(295): bdCache_Core->_getRequestUriSignature('https://www.phc...', Array)
#1 /library/bdCache/XenForo/DataWriter/DiscussionMessage/Post.php(15): bdCache_Core->purgeCache('https://www.phc...')
#2 /library/XenForo/DataWriter.php(1411): bdCache_XenForo_DataWriter_DiscussionMessage_Post->_postSaveAfterTransaction()
#3 /library/Dark/TaigaChat/DataWriter/DiscussionMessage/Post.php(7): XenForo_DataWriter->save()
#4 /library/Dark/TaigaChat/CronEntry/CleanUp.php(67): Dark_TaigaChat_DataWriter_DiscussionMessage_Post->save()
#5 [internal function]: Dark_TaigaChat_CronEntry_CleanUp::runDailyCleanUp(Array)
#6 /library/XenForo/Model/Cron.php(356): call_user_func(Array, Array)
#7 /library/XenForo/Deferred/Cron.php(24): XenForo_Model_Cron->runEntry(Array)
#8 /library/XenForo/Model/Deferred.php(256): XenForo_Deferred_Cron->execute(Array, Array, 7.9999990463257, '')
#9 /library/XenForo/Model/Deferred.php(390): XenForo_Model_Deferred->runDeferred(Array, 7.9999990463257, '', false)
#10 /library/XenForo/Model/Deferred.php(335): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#11 /deferred.php(23): XenForo_Model_Deferred->run(false)
#12 {main}

Request State
array(3) {
["url"] => string(37) "https://www.phcorner.net/deferred.php"
["_GET"] => array(0) {
}
["_POST"] => array(4) {
["_xfRequestUri"] => string(28) "/find-new/88455/posts?page=5"
["_xfNoRedirect"] => string(1) "1"
["_xfToken"] => string(8) "********"
["_xfResponseType"] => string(4) "json"
}
}
Do you have any ideas why TaigaChat create a post in some cron job?
 
Yes, It archives chat , messages.
So this is not an issue with your addon?
Archive into a thread or something?

It is a problem with this add on because it does not expect to process post in a cron job. I'll find way to workaround this.
 
I've noticed that when someone posts in a thread it is not immediately updated in the recent threads block of Xenporta if you have BD Cache on. Turned it off for now.
 
Top Bottom