News:

Join the Facebook Fan Page.

Main Menu

Uncached Query

Started by Stanyy, May 01, 2015, 05:10:25 PM

Previous topic - Next topic

Stanyy

How would I go about caching a query?
For example I need to use the following query in boardindex but I was told it would be loaded on every page load:

How to cache?


$request = $smcFunc['db_query']('','
SELECT SUM(log.score) AS score, log.id_msg AS msg
FROM {db_prefix}log_gpbp AS log
JOIN {db_prefix}messages AS mess ON (mess.id_msg = log.id_msg)
JOIN {db_prefix}topics AS top ON (mess.id_topic = top.id_topic)
WHERE log.log_time >= {int:weekago}
AND top.locked = 0
GROUP BY msg
ORDER BY score DESC
LIMIT {int:limit}',
array(
'weekago' => $aWeekAgo,
'limit' => $modSettings['gpbp_show_best_topics']
)
);

Advertisement: