Enable caching wirh comments
This commit is contained in:
parent
93666b5a8d
commit
4053499c38
1 changed files with 10 additions and 0 deletions
|
@ -3213,6 +3213,13 @@ class Diaspora {
|
||||||
*/
|
*/
|
||||||
private static function construct_comment($item, $owner) {
|
private static function construct_comment($item, $owner) {
|
||||||
|
|
||||||
|
$cachekey = "diaspora:construct_comment:".$item['guid'];
|
||||||
|
|
||||||
|
$result = Cache::get($cachekey);
|
||||||
|
if (!is_null($result)) {
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
$p = q("SELECT `guid` FROM `item` WHERE `parent` = %d AND `id` = %d LIMIT 1",
|
$p = q("SELECT `guid` FROM `item` WHERE `parent` = %d AND `id` = %d LIMIT 1",
|
||||||
intval($item["parent"]),
|
intval($item["parent"]),
|
||||||
intval($item["parent"])
|
intval($item["parent"])
|
||||||
|
@ -3237,6 +3244,9 @@ class Diaspora {
|
||||||
if ($item['thr-parent'] != $item['parent-uri']) {
|
if ($item['thr-parent'] != $item['parent-uri']) {
|
||||||
$comment['thread_parent_guid'] = self::get_guid_from_uri($item['thr-parent'], $item['uid']);
|
$comment['thread_parent_guid'] = self::get_guid_from_uri($item['thr-parent'], $item['uid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cache::set($cachekey, $comment, CACHE_QUARTER_HOUR);
|
||||||
|
|
||||||
return($comment);
|
return($comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue