{"id":18772,"date":"2020-02-26T12:07:07","date_gmt":"2020-02-26T17:07:07","guid":{"rendered":"https:\/\/www.boldgrid.com\/support\/?p=18772"},"modified":"2024-02-22T10:02:26","modified_gmt":"2024-02-22T15:02:26","slug":"configuring-object-caching-methods-in-w3-total-cache","status":"publish","type":"post","link":"https:\/\/www.boldgrid.com\/support\/w3-total-cache\/configuring-object-caching-methods-in-w3-total-cache\/","title":{"rendered":"Configuring Object Caching Methods in W3 Total Cache"},"content":{"rendered":"<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/REC-html40\/loose.dtd\">\n<?xml encoding=\"utf-8\" ?><html><body><p>While Page Caching can greatly help to reduce the response time of a site through caching static pages, there are still many non-cached requests for Objects. <b>Object Caching<\/b> will further improve performance by caching these Objects.<\/p>\n<p>The idea of an Object Cache is that the WordPress Core, themes, and plugins may store some data that is frequently accessed and rarely changed in an object store. This is so these objects will not have to be retrieved and processed on each request. Ultimately, <b>Object Caching<\/b> will reduce the total number of database queries required for each page, and because the CPU does not have to rebuild these blocks of data your response time will decrease.<\/p>\n<p>In reality, this potential performance improvements of <b>Object Caching<\/b> are highly dependent on which plugins or themes you use and whether they correctly store these objects. For example, your response time may not decrease if objects are stored and rarely (if ever) used.<\/p>\n<div class=\"boldgrid-section\" style=\"margin-top: 60px;\">\n<div class=\"container w3tc-radius\" style=\"border-width: 0px; background-image: url('https:\/\/www.boldgrid.com\/wp-content\/uploads\/2023\/07\/upsell-darker-alt.png'); background-size: cover; background-position: 50% 5%;\" data-image-url=\"https:\/\/www.boldgrid.com\/wp-content\/uploads\/2023\/07\/upsell-darker-alt.png\">\n<div class=\"row upsell-column\" style=\"padding-top: 2em; padding-bottom: 2em; color: #ffffff;\">\n<div class=\"col-lg-1 col-md-1 col-sm-12 col-xs-12 hidden-sm\">&nbsp;<\/div>\n<div class=\"col-lg-5 col-md-6 col-xs-12 col-sm-7\">\n<p class=\"h3\" style=\"color: #ffffff; line-height: 40px; margin-top: 0;\"><strong>Speed Up Your WordPress Website.<\/strong><\/p>\n<p style=\"color: #ffffff;\" class=\"h4\">A Difference of Just 100ms in Page Load Speeds Can Cause a Visitor to Prefer Your Competitor&rsquo;s Website.<\/p>\n<\/div>\n<div class=\"col-lg-6 col-md-5 col-sm-5 col-xs-12 text-center align-column-center\">\n<p class=\"\" style=\"border-width: 0px;\"><a class=\"button-w3tc-white\" style=\"border: 2px solid #30BEC4; font-size: 18px; padding: 15px 30px;\" href=\"https:\/\/www.boldgrid.com\/w3-total-cache\/#pricing\">View Plans<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 id=\"choosing-a-method\">Choosing a Method<\/h2>\n<p><b>Object Caching<\/b> assists in improving performance by reducing the total number of database queries required to generate pages for many users. This works by freeing up MySQL server resources taken by serving repeated queries returning the same data each time, so that it has more power to handle real dynamic data.<\/p>\n<p>For suggestions tailored to your hosting plan and recommendations on which <b>Object Caching<\/b> method to use, consider <b>upgrading to W3 Total Cache Pro<\/b> for access to the <b>Statistics<\/b> page.<\/p>\n<h3 id=\"shared-server\">Shared Server<\/h3>\n<p>In shared hosting platforms, you may only be able to cache files to a disk. In such cases, there is only one option available for Object Caching unless your hosting provider has a method listed under VPS \/ Dedicated Server or Multiple Servers available.<\/p>\n<h4 id=\"disk\">Disk<\/h4>\n<p>Disk-based caching stores the Objects to a folder within wp-content\/cache as a file or set of files. Disk-based <b>Object Caching<\/b> is generally not recommended unless you are caching a small number of objects that are not likely to change often.<\/p>\n<h4 id=\"caveats\">Caveats<\/h4>\n<p>Unless you have a specific scenario where you are willing to manage <b>Global Groups<\/b> and <b>Non-persistent Groups<\/b> under <b>Object Caching &gt; Advanced<\/b>, it is best to consider upgrading to a VPS \/ Dedicated Server where in-memory solutions are possible, or using a third-party solution.<\/p>\n<h3 id=\"vps--dedicated-server\">VPS \/ Dedicated Server<\/h3>\n<p>On VPS and\/or Dedicated hosting platforms you may use an in-memory caching solution rather than exclusively caching to disk. In-memory caching takes advantage of the much faster read\/write speeds and lower latency of accessing data from system memory compared to disk-based alternatives.<\/p>\n<h4 id=\"alternative-php-cache-apc--apcu\">Alternative PHP Cache (APC \/ APCu)<\/h4>\n<p><b>APC<\/b> refers to <b>Alternative PHP Cache<\/b> which provides in-memory Opcode caching and a key-value store for looking up cached items. This is largely deprecated in favor of modern Opcode Caching mechanisms, as <b>APC<\/b> is not supported in the PHP 7.x branch.<\/p>\n<p><b>APCu<\/b> is similar to <b>APC<\/b>, though in order to support modern variants of PHP it is stripped of Opcode Caching and only provides the in-memory key-value store mechanisms. When paired with modern Opcode Caching mechanisms it can provide the functionality originally provided by <b>APC<\/b>, though it should only be used when you require having a limited cache size.<\/p>\n<p>APC\/APCu is not stable when a lot of memory allocated. In cases where you are caching a small amount of data, <b>APC\/APCu<\/b> may be the ideal method for single-instance hosting platforms such as <a href=\"\/support\/w3-total-cache\/configuring-w3-total-cache-for-wordpress-with-vps-or-dedicated-hosting\/\">VPS or Dedicated hosting<\/a>.<\/p>\n<h4 id=\"eaccelerator\">eAccelerator<\/h4>\n<p><b>eAccelerator<\/b> is an in-memory Opcode caching solution that supports the PHP 4.x and 5.x major versions. This is largely deprecated in favor of modern Opcode Caching mechanisms, as <b>eAccelerator<\/b> is not supported in the PHP 7.x branch.<\/p>\n<h4 id=\"xcache\">XCache<\/h4>\n<p>XCache is an in-memory Opcode caching solution that supports up to the PHP 5.6 release. This is largely deprecated in favor of modern Opcode Caching mechanisms, as <b>XCache<\/b> is not supported in the PHP 7.x branch.<\/p>\n<h4 id=\"wincache-recommended-for-windows-based-environments\">WinCache (Recommended for Windows-based Environments)<\/h4>\n<p><b>WinCache<\/b> is an extension for Microsoft IIS which provides in-memory Opcode caching and currently supports up to IIS 10 as of 04\/30\/2019. Check the official Microsoft product page for the latest information.<\/p>\n<h3 id=\"multiple-server\">Multiple Server<\/h3>\n<p>If you have multiple hosting plans where one plan has root-level access, or if your hosting provider offers addons or bundles providing one of the following solutions, you may offload your in-memory caching to another server. This allows you to separate your actual site and caching solution between multiple servers to compliment each other, and allows for easier scaling to serve many users.<\/p>\n<h4 id=\"memcached\">Memcached<\/h4>\n<p><b>Memcached<\/b> is a high-performance, distributed memory object caching system meant to speed up dynamic web applications by alleviating database load. It provides an in-memory key-value store for small chunks of arbitrary data (strings, objects) from the results of database calls, API calls, or page rendering.<\/p>\n<p><b>Memcached<\/b> is ideal for relatively small and static data, and as a result may be more efficient than Redis<b>. <\/b>It is also multithreaded, which may be a benefit when using a VPS or Dedicated Server with a large resource pool.<\/p>\n<h4 id=\"redis\">Redis<\/h4>\n<p><b>Redis<\/b> is an in-memory data structure store which may be used as a database, cache, and message broker. <b>Redis<\/b> is somewhat of an industry-standard at the time of writing, and can be defined simply as a superset of <b>Memcached<\/b> when purely talking about similarities between each feature set.<\/p>\n<h2 id=\"faq\">FAQ<\/h2>\n<h3 id=\"enabling-object-caching-made-my-site-slower\">Enabling Object Caching made my site slower<\/h3>\n<p>When checking the total amount of space used for object caching, if the total allocation of storage appears to be higher than expected it&rsquo;s a bad sign. When too much data is stored by themes or plugins in the object store, there are different issues that may arise depending on whether you are using disk-based or memory-based caching.<\/p>\n<p>If you are using a disk-based Object Cache, the object store may leave too little available free space for cache flushing operations to complete successfully in extreme cases. Should this occur, consider switching to an in-memory cache as this allows granular control of the max memory that should be consumed by caching.<\/p>\n<p>When using a memory-based Object Cache, if there is too little free space for cache flushing operations to complete it will arbitrarily remove data, which may result in the required objects not being present.<\/p>\n<p>If you are running into continuous space-related issues with disk-based or in-memory caching, You may attempt the following:<\/p>\n<ul>\n<li>Enable <b>Debug Mode<\/b> and review the total space used. Consider excluding highly dynamic pages that are consuming space for little to no benefit.<\/li>\n<li>Consider upgrading to W3 Total Cache Pro, which provides the Statistics page which can help to identify the following:\n<ul>\n<li>Whether the number of cache flushing operations being performed is excessively low. If this number is low, you may be storing data that is rarely (or never) used. Excluding by page or by group may help to normalize the hit rate.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/body><\/html>\n","protected":false},"excerpt":{"rendered":"<p>While Page Caching can greatly help to reduce the response time of a site through caching static pages, there are still many non-cached requests for Objects. Object Caching will further improve performance by caching these Objects. The idea of an Object Cache is that the WordPress Core, themes, and plugins may store some data that [&hellip;]<\/p>\n","protected":false},"author":529,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"bgseo_title":"","bgseo_description":"","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[744,692],"tags":[],"class_list":["post-18772","post","type-post","status-publish","format-standard","hentry","category-object-cache","category-w3-total-cache"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/users\/529"}],"replies":[{"embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/comments?post=18772"}],"version-history":[{"count":7,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18772\/revisions"}],"predecessor-version":[{"id":125526,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/posts\/18772\/revisions\/125526"}],"wp:attachment":[{"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/media?parent=18772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/categories?post=18772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.boldgrid.com\/support\/wp-json\/wp\/v2\/tags?post=18772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}