{"id":34525,"date":"2021-10-27T15:04:51","date_gmt":"2021-10-27T15:04:51","guid":{"rendered":"https:\/\/www.hostduplex.com\/kb\/?post_type=ht_kb&#038;p=34525"},"modified":"2021-11-01T20:02:47","modified_gmt":"2021-11-01T20:02:47","slug":"how-to-enable-caching-on-xenforo","status":"publish","type":"ht_kb","link":"https:\/\/www.hostduplex.com\/kb\/article\/how-to-enable-caching-on-xenforo\/","title":{"rendered":"How to enable caching on XenForo"},"content":{"rendered":"\n<p>XenForo recommends defining a cache for larger installations, as it can save on processing time and database queries. It can be configures in your <strong>src\/config.php<\/strong> file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"supported-providers\">Supported providers<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#supported-providers\" target=\"_blank\" rel=\"noopener\"><\/a><\/h2>\n\n\n\n<p>These are the most popular XenForo cache providers:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>APC<\/li><li>File system cache<\/li><li>Memcached<\/li><li>Redis<\/li><li>WinCache<\/li><li>XCache<\/li><\/ul>\n\n\n\n<p>Many of the cache providers will require software to be explicitly installed on your server. You may wish to inquire with your host as to which options are available.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"apc\">APC<\/h3>\n\n\n\n<p id=\"apc\">To configure APC, add the following snippet of code to your src\/config.php file.<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#apc\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$config['cache']['enabled'] = <strong>true<\/strong>;\n$config['cache']['provider'] = 'ApcCache';<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"file-system-cache\">File system cache<\/h3>\n\n\n\n<p id=\"file-system-cache\">To configure File system cache, add the following snippet of code to your src\/config.php file.<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#apc\" target=\"_blank\" rel=\"noopener\"><\/a> <a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#file-system-cache\" target=\"_blank\" rel=\"noopener\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$config['cache']['enabled'] = <strong>true<\/strong>;\n$config['cache']['provider'] = 'Filesystem';\n$config['cache']['config'] = [\n    'directory' =&gt; '\/path\/to\/your\/cache\/directory'\n];<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"memcached\">Memcached<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#memcached\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p> To configure Memcached, add the following snippet of code to your src\/config.php file.<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#apc\" target=\"_blank\" rel=\"noopener\"><\/a> <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$config['cache']['enabled'] = <strong>true<\/strong>;\n$config['cache']['provider'] = 'Memcached';\n$config['cache']['config'] = [\n    'server' =&gt; '127.0.0.1'\n];<\/pre>\n\n\n\n<p>It is also possible to configure an array of servers, if required.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"redis\">Redis<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#redis\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p> To configure Redis, add the following snippet of code to your src\/config.php file.<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#apc\" target=\"_blank\" rel=\"noopener\"><\/a> <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$config['cache']['enabled'] = <strong>true<\/strong>;\n$config['cache']['provider'] = 'Redis';\n$config['cache']['config'] = [\n    'host' =&gt; '127.0.0.1',\n    'password' =&gt; 'password'\n];<\/pre>\n\n\n\n<p>Redis has a number of additional configuration options. The following list will demonstrate the default values of all of the supported configuration items available:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">'host' =&gt; '',\n'port' =&gt; 6379,\n'timeout' =&gt; 0.0,\n'password' =&gt; '',\n'database' =&gt; 0,\n'persistent' =&gt; <strong>false<\/strong>,\n'persistent_id' =&gt; ''<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"wincache\">WinCache<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#wincache\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p> To configure WinCache, add the following snippet of code to your src\/config.php file.<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#apc\" target=\"_blank\" rel=\"noopener\"><\/a> <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$config['cache']['enabled'] = <strong>true<\/strong>;\n$config['cache']['provider'] = 'WinCache';<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"xcache\">XCache<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#xcache\" target=\"_blank\" rel=\"noopener\"><\/a><\/h3>\n\n\n\n<p> To configure XCache, add the following snippet of code to your src\/config.php file.<a href=\"https:\/\/xenforo.com\/docs\/xf2\/cache\/#apc\" target=\"_blank\" rel=\"noopener\"><\/a> <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$config['cache']['enabled'] = <strong>true<\/strong>;\n$config['cache']['provider'] = 'XCache';<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-text-color has-background has-purple-background-color has-purple-color is-style-default\"\/>\n\n\n\n<p>If you are a Host Duplex customer and still have questions, please open a ticket in the&nbsp;<a href=\"https:\/\/secure.hostduplex.com\/clientarea.php\" target=\"_blank\" rel=\"noopener\">Host Duplex client portal.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>XenForo recommends defining a cache for larger installations, as it can save on processing time and database queries. It can be configures in your src\/config.php file. Supported providers These are the most popular XenForo cache providers: APC File system cache Memcached Redis WinCache XCache Many of the cache providers will&#8230;<\/p>\n","protected":false},"author":2,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"ht-kb-category":[229],"ht-kb-tag":[227,130,228,221,226,225,224,222,223,43],"class_list":["post-34525","ht_kb","type-ht_kb","status-publish","format-standard","hentry","ht_kb_category-xenforo","ht_kb_tag-apc","ht_kb_tag-cache","ht_kb_tag-config-php","ht_kb_tag-enable","ht_kb_tag-file-system-cache","ht_kb_tag-memcached","ht_kb_tag-redis","ht_kb_tag-wincache","ht_kb_tag-xcache","ht_kb_tag-xenforo"],"_links":{"self":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb\/34525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/comments?post=34525"}],"version-history":[{"count":2,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb\/34525\/revisions"}],"predecessor-version":[{"id":34546,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb\/34525\/revisions\/34546"}],"wp:attachment":[{"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/media?parent=34525"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=34525"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.hostduplex.com\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=34525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}