我有一些从数据库中获取数据的 mysql 查询,结果在 24 小时内不会改变,我想存储在缓存中,如何将结果缓存 24 小时并在过期后重新缓存它们?
<?php
$getTopics=$db->loadAssoc($db->setQuery("SELECT * , categories.title AS category_title,
status_topics.title as status_topic
FROM contents
JOIN categories ON categories.id = contents.category
JOIN status_topics ON status_topics.id = contents.status "));
$getCategories = $db->loadAssoc($db->setQuery("SELECT * FROM categories"));
$getTags = $db->loadAssoc($db->setQuery("SELECT * FROM status_topics"));
$getPages = $db->loadAssoc($db->setQuery("SELECT * FROM pages"));
$getSiteInformation = $db->loadRow($db->setQuery("SELECT * FROM settings JOIN categories"));
$getSubDomainInformation = $db->loadAssoc($db->setQuery("SELECT * FROM sub_domains"));
$getUserInformation = $db->loadAssoc($db->setQuery("SELECT * FROM users"));
?>