aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_notification.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2014-05-29 05:27:57 +0000
committerrvelices <rv-github@modusoptimus.com>2014-05-29 05:27:57 +0000
commit867d779ffc3a9e363428288ef359ca4430e85582 (patch)
tree3eda81617825ea92d80351bcb0fbd8f4113f3029 /include/functions_notification.inc.php
parent8aaa3612eba4094eeb1dadce4d11ce553cc10ed4 (diff)
added persistent cache for some slow queries in feed notification (even if not important to be fast on RSS feed, it might slow down galleries that are very large and actively used)
git-svn-id: http://piwigo.org/svn/trunk@28560 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_notification.inc.php')
-rw-r--r--include/functions_notification.inc.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php
index 623369915..bc4d1a374 100644
--- a/include/functions_notification.inc.php
+++ b/include/functions_notification.inc.php
@@ -441,8 +441,13 @@ function news($start=null, $end=null, $exclude_img_cats=false, $add_url=false)
*/
function get_recent_post_dates($max_dates, $max_elements, $max_cats)
{
- global $conf, $user;
+ global $conf, $user, $persistent_cache;
+ $cache_key = $persistent_cache->make_key('recent_posts'.$user['id'].$user['cache_update_time'].$max_dates.$max_elements.$max_cats);
+ if ($persistent_cache->get($cache_key, $cached))
+ {
+ return $cached;
+ }
$where_sql = get_std_sql_where_restrict_filter('WHERE', 'i.id', true);
$query = '
@@ -493,6 +498,7 @@ SELECT
}
}
+ $persistent_cache->set($cache_key, $dates);
return $dates;
}