update_rss_feed: use memcache

This commit is contained in:
Andrew Dolgov 2010-01-20 12:50:19 +03:00
parent c517f9b7e5
commit 602690e577
1 changed files with 41 additions and 27 deletions

View File

@ -510,6 +510,8 @@
function update_rss_feed($link, $feed_url, $feed, $ignore_daemon = false) {
global $memcache;
if (!$_REQUEST["daemon"] && !$ignore_daemon) {
return false;
}
@ -600,6 +602,15 @@
error_reporting(0);
}
$obj_id = md5("FEEDOBJ:$fetch_url");
if ($memcache && $obj = $memcache->get($obj_id)) {
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {
_debug("update_rss_feed: data found in memcache [$obj_id]");
}
$rss = $obj;
} else {
if (!$use_simplepie) {
$rss = fetch_rss($fetch_url);
} else {
@ -634,6 +645,9 @@
$rss->init();
}
if ($rss && $memcache) $memcache->add($obj_id, $rss, 0, 300);
}
// print_r($rss);
if (defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug']) {