PDA

View Full Version : How to check if a post is cached or not?


Chris8
03-14-2013, 12:06 AM
Does anyone know by a chance how to check if a given post is cached or not?
I'm working on something and that knowledge would be helpful. I could not find the answer on my own.

Digital Jedi
03-14-2013, 04:27 AM
It's usually not per post, but per template. Enabling debug mode will let you see which templates are not being cached. https://vborg.vbsupport.ru/showthread.php?t=82835

kh99
03-14-2013, 02:51 PM
There is a table called postparsed that caches the html for a post. It's done separately for each style and language, so you would really need to check postid, styleid, and languageid to see if a given postid is cached for the current value of STYLEID and LANGUAGEID. So maybe something like:

$cached = $vbulletin->db->query_first("
SELECT * FROM " . TABLE_PREFIX . "postparsed
WHERE postid = $postid
AND styleid = " . intval(STYLEID) . "
AND languageid = " . intval(LANGUAGEID) . "
");
if ($cached)
{
/// post is cached
}

Chris8
03-14-2013, 06:48 PM
Thank you Kevin!