summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2010-01-18 13:55:28 +0300
committerAndrew Dolgov <[email protected]>2010-01-18 13:55:28 +0300
commitbd3f2ade87d63b5340bf3be26f33c6f74ac35f8c (patch)
treebb4f0161fd29d48da095cf76d8621c4cfeae4761 /functions.php
parentfde715c1f21fbbe651b7068c3a066be8375ee5fd (diff)
editTagsSave: invalidate article cache
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/functions.php b/functions.php
index 7350ef28f..9a9aab71c 100644
--- a/functions.php
+++ b/functions.php
@@ -4496,19 +4496,30 @@
function get_article_tags($link, $id, $owner_uid = 0) {
+ global $memcache;
+
$a_id = db_escape_string($id);
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
- $tmp_result = db_query($link, "SELECT DISTINCT tag_name,
+ $query = "SELECT DISTINCT tag_name,
owner_uid as owner FROM
ttrss_tags WHERE post_int_id = (SELECT int_id FROM ttrss_user_entries WHERE
- ref_id = '$a_id' AND owner_uid = '$owner_uid' LIMIT 1) ORDER BY tag_name");
+ ref_id = '$a_id' AND owner_uid = '$owner_uid' LIMIT 1) ORDER BY tag_name";
+ $obj_id = md5("TAGS:$owner_uid:$id");
$tags = array();
-
- while ($tmp_line = db_fetch_assoc($tmp_result)) {
- array_push($tags, $tmp_line["tag_name"]);
+
+ if ($memcache && $obj = $memcache->get($obj_id)) {
+ $tags = $obj;
+ } else {
+ $tmp_result = db_query($link, $query);
+
+ while ($tmp_line = db_fetch_assoc($tmp_result)) {
+ array_push($tags, $tmp_line["tag_name"]);
+ }
+
+ if ($memcache) $memcache->add($obj_id, $tags, 0, 3600);
}
return $tags;
@@ -6500,11 +6511,11 @@
$query = "SELECT * FROM ttrss_enclosures
WHERE post_id = '$id' AND content_url != ''";
- $cache_id = md5($query);
+ $obj_id = md5("ENCLOSURES:$id");
$rv = array();
- if ($memcache && $obj = $memcache->get($cache_id)) {
+ if ($memcache && $obj = $memcache->get($obj_id)) {
$rv = $obj;
} else {
$result = db_query($link, $query);
@@ -6513,7 +6524,7 @@
while ($line = db_fetch_assoc($result)) {
array_push($rv, $line);
}
- if ($memcache) $memcache->add($cache_id, $rv, 0, 3600);
+ if ($memcache) $memcache->add($obj_id, $rv, 0, 3600);
}
}