Cache forever, destroy on change.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10354 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2009-12-20 14:31:37 +00:00
parent d64516057f
commit 183045072f
2 changed files with 8 additions and 5 deletions

View file

@ -562,8 +562,8 @@ class phpbb_feed_base
global $db, $cache; global $db, $cache;
static $forum_ids; static $forum_ids;
// Matches acp/acp_board.php
$cache_name = 'feed_excluded_forum_ids'; $cache_name = 'feed_excluded_forum_ids';
$cache_ttl = 300;
if (!isset($forum_ids) && ($forum_ids = $cache->get('_' . $cache_name)) === false) if (!isset($forum_ids) && ($forum_ids = $cache->get('_' . $cache_name)) === false)
{ {
@ -579,7 +579,7 @@ class phpbb_feed_base
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$cache->put('_' . $cache_name, $forum_ids, $cache_ttl); $cache->put('_' . $cache_name, $forum_ids);
} }
return $forum_ids; return $forum_ids;
@ -1046,8 +1046,8 @@ class phpbb_feed_news extends phpbb_feed_base
global $db, $cache; global $db, $cache;
static $forum_ids; static $forum_ids;
// Matches acp/acp_board.php
$cache_name = 'feed_news_forum_ids'; $cache_name = 'feed_news_forum_ids';
$cache_ttl = 300;
if (!isset($forum_ids) && ($forum_ids = $cache->get('_' . $cache_name)) === false) if (!isset($forum_ids) && ($forum_ids = $cache->get('_' . $cache_name)) === false)
{ {
@ -1063,7 +1063,7 @@ class phpbb_feed_news extends phpbb_feed_base
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$cache->put('_' . $cache_name, $forum_ids, $cache_ttl); $cache->put('_' . $cache_name, $forum_ids);
} }
return $forum_ids; return $forum_ids;

View file

@ -29,6 +29,7 @@ class acp_board
{ {
global $db, $user, $auth, $template; global $db, $user, $auth, $template;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $cache;
$user->add_lang('acp/board'); $user->add_lang('acp/board');
@ -268,7 +269,6 @@ class acp_board
'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
'feed_limit' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true), 'feed_limit' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => true),
'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
'feed_overall_forums_limit' => array('lang' => 'ACP_FEED_OVERALL_FORUMS_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false),
'feed_overall_topics' => array('lang' => 'ACP_FEED_OVERALL_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 'feed_overall_topics' => array('lang' => 'ACP_FEED_OVERALL_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
'feed_overall_topics_limit' => array('lang' => 'ACP_FEED_OVERALL_TOPIC_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false), 'feed_overall_topics_limit' => array('lang' => 'ACP_FEED_OVERALL_TOPIC_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false),
'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
@ -469,6 +469,9 @@ class acp_board
// Store news and exclude ids // Store news and exclude ids
if ($mode == 'feed' && $submit) if ($mode == 'feed' && $submit)
{ {
$cache->destroy('_feed_news_forum_ids');
$cache->destroy('_feed_excluded_forum_ids');
$this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
$this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
} }