diff --git a/inc/config.php b/inc/config.php index cceaabe2..6df9a79f 100644 --- a/inc/config.php +++ b/inc/config.php @@ -56,6 +56,8 @@ // Experimental: cache entire thread HTML (for mods, since we already cache it with static HTML anyway) // Increases load times for mods but might take up a bit of memory $config['memcached']['cache_threads'] = false; + // Timeout for cached objects such as posts and HTML + $config['memcached']['timeout'] = 86400; // one day // The name of the session cookie (PHP's $_SESSION) $config['cookies']['session']= 'imgboard'; 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) . '