remove memcached stuff

master
Andrew Dolgov 13 years ago
parent 713d98563d
commit 0e4a7d7a94

@ -402,10 +402,6 @@ class Pref_Filters extends Protected_Handler {
function editSave() {
global $memcache;
if ($memcache) $memcache->flush();
$savemode = db_escape_string($_REQUEST["savemode"]);
$reg_exp = db_escape_string(trim($_REQUEST["reg_exp"]));
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
@ -476,8 +472,6 @@ class Pref_Filters extends Protected_Handler {
function remove() {
if ($memcache) $memcache->flush();
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
@ -487,8 +481,6 @@ class Pref_Filters extends Protected_Handler {
function add() {
if ($memcache) $memcache->flush();
$savemode = db_escape_string($_REQUEST["savemode"]);
$regexp = db_escape_string(trim($_REQUEST["reg_exp"]));
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));

@ -360,7 +360,6 @@ class RPC extends Protected_Handler {
}
function setArticleTags() {
global $memcache;
$id = db_escape_string($_REQUEST["id"]);
@ -414,11 +413,6 @@ class RPC extends Protected_Handler {
db_query($this->link, "COMMIT");
if ($memcache) {
$obj_id = md5("TAGS:".$_SESSION["uid"].":$id");
$memcache->delete($obj_id);
}
$tags = get_article_tags($this->link, $id);
$tags_str = format_tags_string($tags, $id);
$tags_str_full = join(", ", $tags);

@ -83,11 +83,6 @@
startup_gettext();
if (defined('MEMCACHE_SERVER')) {
$memcache = new Memcache;
$memcache->connect(MEMCACHE_SERVER, 11211);
}
require_once 'db-prefs.php';
require_once 'version.php';
@ -3079,8 +3074,6 @@
function get_article_tags($link, $id, $owner_uid = 0, $tag_cache = false) {
global $memcache;
$a_id = db_escape_string($id);
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
@ -3093,9 +3086,6 @@
$obj_id = md5("TAGS:$owner_uid:$id");
$tags = array();
if ($memcache && $obj = $memcache->get($obj_id)) {
$tags = $obj;
} else {
/* check cache first */
if ($tag_cache === false) {
@ -3126,9 +3116,6 @@
AND owner_uid = $owner_uid");
}
if ($memcache) $memcache->add($obj_id, $tags, 0, 3600);
}
return $tags;
}
@ -3590,15 +3577,6 @@
function load_filters($link, $feed, $owner_uid, $action_id = false) {
$filters = array();
global $memcache;
$obj_id = md5("FILTER:$feed:$owner_uid:$action_id");
if ($memcache && $obj = $memcache->get($obj_id)) {
return $obj;
} else {
if ($action_id) $ftype_query_part = "action_id = '$action_id' AND";
@ -3635,11 +3613,9 @@
array_push($filters[$line["name"]], $filter);
}
if ($memcache) $memcache->add($obj_id, $filters, 0, 3600*8);
return $filters;
}
}
function get_score_pic($score) {
if ($score > 100) {
@ -3915,15 +3891,8 @@
}
function get_article_labels($link, $id) {
global $memcache;
$obj_id = md5("LABELS:$id:" . $_SESSION["uid"]);
$rv = array();
if ($memcache && $obj = $memcache->get($obj_id)) {
return $obj;
} else {
$result = db_query($link, "SELECT label_cache FROM
ttrss_user_entries WHERE ref_id = '$id' AND owner_uid = " .
@ -3954,13 +3923,11 @@
$line["bg_color"]);
array_push($rv, $rk);
}
if ($memcache) $memcache->add($obj_id, $rv, 0, 3600);
if (count($rv) > 0)
label_update_cache($link, $id, $rv);
else
label_update_cache($link, $id, array("no-labels" => 1));
}
return $rv;
}
@ -4017,13 +3984,6 @@
function label_add_article($link, $id, $label, $owner_uid) {
global $memcache;
if ($memcache) {
$obj_id = md5("LABELS:$id:$owner_uid");
$memcache->delete($obj_id);
}
$label_id = label_find_id($link, $label, $owner_uid);
if (!$label_id) return;
@ -4047,15 +4007,8 @@
}
function label_remove($link, $id, $owner_uid) {
global $memcache;
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
if ($memcache) {
$obj_id = md5("LABELS:$id:$owner_uid");
$memcache->delete($obj_id);
}
db_query($link, "BEGIN");
$result = db_query($link, "SELECT caption FROM ttrss_labels2
@ -4375,26 +4328,17 @@
function get_article_enclosures($link, $id) {
global $memcache;
$query = "SELECT * FROM ttrss_enclosures
WHERE post_id = '$id' AND content_url != ''";
$obj_id = md5("ENCLOSURES:$id");
$rv = array();
if ($memcache && $obj = $memcache->get($obj_id)) {
$rv = $obj;
} else {
$result = db_query($link, $query);
if (db_num_rows($result) > 0) {
while ($line = db_fetch_assoc($result)) {
array_push($rv, $line);
}
if ($memcache) $memcache->add($obj_id, $rv, 0, 3600);
}
}
return $rv;

@ -209,34 +209,13 @@
}
}
function update_rss_feed($link, $feed, $ignore_daemon = false, $no_cache = false) {
global $memcache;
/* Update all feeds with the same URL to utilize memcache */
if ($memcache) {
$result = db_query($link, "SELECT f1.id
FROM ttrss_feeds AS f1, ttrss_feeds AS f2
WHERE f2.feed_url = f1.feed_url AND f2.id = '$feed'");
while ($line = db_fetch_assoc($result)) {
update_rss_feed_real($link, $line["id"], $ignore_daemon, $no_cache);
}
} else {
update_rss_feed_real($link, $feed, $ignore_daemon, $no_cache);
}
}
function update_rss_feed_real($link, $feed, $ignore_daemon = false, $no_cache = false,
function update_rss_feed($link, $feed, $ignore_daemon = false, $no_cache = false,
$override_url = false) {
require_once "lib/simplepie/simplepie.inc";
require_once "lib/magpierss/rss_fetch.inc";
require_once 'lib/magpierss/rss_utils.inc';
global $memcache;
$debug_enabled = defined('DAEMON_EXTENDED_DEBUG') || $_REQUEST['xdebug'];
if (!$_REQUEST["daemon"] && !$ignore_daemon) {
@ -334,18 +313,6 @@
_debug("update_rss_feed: fetching [$fetch_url]...");
}
$obj_id = md5("FDATA:$use_simplepie:$fetch_url");
if ($memcache && $obj = $memcache->get($obj_id)) {
if ($debug_enabled) {
_debug("update_rss_feed: data found in memcache.");
}
$rss = $obj;
} else {
// Ignore cache if new feed or manual update.
$cache_age = (is_null($last_updated) || $last_updated == '1970-01-01 00:00:00') ?
-1 : get_feed_update_interval($link, $feed) * 60;
@ -389,9 +356,6 @@
$rss->init();
}
if ($memcache && $rss) $memcache->add($obj_id, $rss, 0, 300);
}
// print_r($rss);
if ($debug_enabled) {

Loading…
Cancel
Save