From 867d779ffc3a9e363428288ef359ca4430e85582 Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 29 May 2014 05:27:57 +0000 Subject: 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 --- include/functions_notification.inc.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/functions_notification.inc.php') 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; } -- cgit v1.2.3