We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b01990eb authored by Mike Sheldon's avatar Mike Sheldon

Make caching period customisable when creating tag clouds

parent 03a28a84
......@@ -34,7 +34,7 @@ class TagCloud {
* inaccurate @param float $max_font_size maximum font size (px, em, %, etc)
* @return array tagcloud
*/
static function generateTagCloud($table, $field, $limit = 40, $constraint = null, $constrained_field = false) {
static function generateTagCloud($table, $field, $limit = 40, $constraint = null, $constrained_field = false, $cache_period = 7200) {
global $adodb;
if (!is_string($field)) return false;
if (!is_string($table)) return false;
......@@ -57,7 +57,7 @@ class TagCloud {
}
$query .= ' GROUP BY ' . $field . ' ORDER BY count DESC LIMIT ' . $limit;
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$res = $adodb->CacheGetAll(7200,$query);
$res = $adodb->CacheGetAll($cache_period, $query);
if (!$res) {
throw new Exception('ERROR ' . $query);
} else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment