From e60a6a1a582478d76893beec7408e7ea752c876c Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 19 May 2011 21:50:19 +1000 Subject: cache built posts' HTML with memcached --- inc/display.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'inc/display.php') diff --git a/inc/display.php b/inc/display.php index 7ec95ef3..9c7843b9 100644 --- a/inc/display.php +++ b/inc/display.php @@ -260,7 +260,12 @@ } public function build($index=false) { - global $board, $config; + global $board, $config, $memcached; + + if(!$this->mod && $config['memcached']['enabled']) { + if($built = $memcached->get('post_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id)) + return $built; + } $built = '
' . '

' . @@ -347,6 +352,10 @@ // Body $built .= '

' . ($index ? truncate($this->body, $this->link()) : $this->body) . '


'; + if(!$this->mod && $config['memcached']['enabled']) { + $memcached->set('post_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id, $built, time() + $config['memcached']['timeout']); + } + return $built; } }; -- cgit v1.3