cache tags per notice
This commit is contained in:
parent
59d0e2f373
commit
d3d0ec5ebe
@ -2004,14 +2004,24 @@ class Notice extends Memcached_DataObject
|
|||||||
public function getTags()
|
public function getTags()
|
||||||
{
|
{
|
||||||
$tags = array();
|
$tags = array();
|
||||||
$tag = new Notice_tag();
|
|
||||||
$tag->notice_id = $this->id;
|
$keypart = sprintf('notice:tags:%d', $this->id);
|
||||||
if ($tag->find()) {
|
|
||||||
while ($tag->fetch()) {
|
$tagstr = self::cacheGet($keypart);
|
||||||
$tags[] = $tag->tag;
|
|
||||||
|
if ($tagstr !== false) {
|
||||||
|
$tags = explode(',', $tagstr);
|
||||||
|
} else {
|
||||||
|
$tag = new Notice_tag();
|
||||||
|
$tag->notice_id = $this->id;
|
||||||
|
if ($tag->find()) {
|
||||||
|
while ($tag->fetch()) {
|
||||||
|
$tags[] = $tag->tag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
self::cacheSet($keypart, implode(',', $tags));
|
||||||
}
|
}
|
||||||
$tag->free();
|
|
||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user