bambua
Well-known member
Rather than reinventing the wheel, in an addon I'm updating I'm building in caching of profile posts. I searched through the code and found getSimpleCacheData and setSimpleCacheData, they are doing the job but I saw that they post and pull the data from the data_registry table. Yes it saves queries doing it this way as it only checks for new posts when the cache needs to be updated, but is there a better way? Another method built in to the software?
Right now here's how i'm doing it:
Thanks!
Right now here's how i'm doing it:
PHP:
$data = XenForo_Application::getSimpleCacheData("RCBDRecentStatus_comments_array");
if (!$data) {
$commentsArray = $db->fetchAll($db->limit("SELECT * FROM xf_profile_post_comment WHERE profile_post_id in(" . $matches . ") ORDER BY profile_post_id DESC, comment_date", $numStatusShown));
XenForo_Application::setSimpleCacheData("RCBDRecentStatus_comments_array", $commentsArray);
} else {
$commentsArray = $data;
}