{"id":80903,"date":"2023-03-15T17:17:24","date_gmt":"2023-03-15T17:17:24","guid":{"rendered":"\/tutorials\/?p=80903"},"modified":"2026-03-09T19:18:06","modified_gmt":"2026-03-09T19:18:06","slug":"what-is-object-cache","status":"publish","type":"post","link":"\/ng\/tutorials\/what-is-object-cache\/","title":{"rendered":"What is object cache in WordPress: how it works, different types, and how to enable it"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>If you are looking for website optimization options, consider utilizing an object cache.<\/p><p>A WordPress website consists of many PHP objects that are constantly built, initiated, and removed by the memory manager. However, these actions may overload your server, causing your site to slow down and experience errors.<\/p><p>An unresponsive website will result in a poor user experience and turn visitors away, causing financial loss. To prevent this issue, make sure to have object caching enabled on your WordPress site, as it can optimize your server and boost the website&rsquo;s responsiveness.<\/p><p>In this article, you&rsquo;ll learn what an object cache is, its advantages, and how it can benefit your WordPress website. We&rsquo;ll also share the best persistent caching solutions on the market &ndash; Redis and Memcached.<\/p><figure class=\"wp-block-image size-large\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/How-to-Speed-Up-Your-Website-EN.pdf\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"566\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-69260\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2022\/11\/eBook-Speed-Up-your-website.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>\n\n\n\n<div class=\"protip\"><div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                   What Is an Object Cache?\n                <\/p>\n            <\/div>\n            <p class=\"protip__content\">Object caching involves storing database query outcomes, allowing for future requests to be fulfilled from the cache, avoiding constant database queries. Given WordPress&rsquo;s reliance on databases as a content management system, this process is particularly crucial.<\/p><\/div>\n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-how-does-an-object-cache-work\">How Does an Object Cache Work<\/h3><p>An object cache reduces repeated and unnecessary queries as it stores the query results from the first request. Let&rsquo;s see how it works in four steps:<\/p><ol class=\"wp-block-list\">\n<li>When a user accesses your website, the browser sends an HTTP request to the web server.<\/li>\n\n\n\n<li>Once the server receives and approves the request, it delivers the data or resources to the browser.<\/li>\n\n\n\n<li>If you enable object caching on your site, the server will create a copy of the user requests and store them in your cache.<\/li>\n\n\n\n<li>Whenever the browser sends the same request, the server will deliver the data from the cache instead of querying the database.<\/li>\n<\/ol><p>However, if a copy doesn&rsquo;t exist, the server will generate a new result and create a copy for future use before sending it back to the user&rsquo;s browser.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn More About Caching                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><a href=\"\/ng\/tutorials\/website-cache\/\">What Is Website Caching<\/a><br>\n<a href=\"\/ng\/tutorials\/clear-browser-cache\/\">How to Clear Browser Cache<\/a><br>\n<a href=\"\/ng\/tutorials\/cache-miss\/\">How to Reduce Cache Misses<\/a><\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-object-cache-advantages\">Object Cache Advantages<\/h3><p>In this section, we&rsquo;ll overview the two most important reasons for using object caching:<\/p><ul class=\"wp-block-list\">\n<li><strong>Access data in microseconds. <\/strong>An object cache speeds up the data retrieval process since the cached content is available on the server. Subsequently, it improves PHP execution times and optimizes the website&rsquo;s performance.<\/li>\n\n\n\n<li><strong>Reduce server workload. <\/strong>Object caching minimizes the number of database queries. It can handle many server tasks, such as delivering the cached content, thus reducing the load, especially during high-traffic times. Furthermore, an object cache can assign cached requests to multiple servers or networks, improving accessibility and ensuring the server works efficiently.<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-wordpress-object-cache\">WordPress Object Cache<\/h2><p>The <a href=\"\/ng\/tutorials\/what-is-wordpress\/\">WordPress CMS<\/a> has a built-in object caching mechanism called <strong>WP_Object_Cache<\/strong> that automatically stores new objects and primitives from the database to the PHP memory.<\/p><p>A WordPress object cache makes the cached content accessible and retrievable using a key, a unique identifier to indicate a specific entry in the database.<\/p><p>This tool is non-persistent, caching objects for a single page load. Once the request is complete, the WordPress object caching mechanism will remove the cached content. When a browser sends a similar request, the system must cache the object again.<\/p><p>A WordPress object cache is enabled by default to ensure your site runs efficiently. Here are the most common <strong>wp_cache<\/strong> functions:<\/p><ul class=\"wp-block-list\">\n<li><strong>wp_cache_set<\/strong> &ndash; adds new data to the cache by overwriting the existing data. If the key doesn&rsquo;t exist, the function will create a data set.<\/li>\n\n\n\n<li><strong>wp_cache_add<\/strong> &ndash; if the key exists, this function won&rsquo;t add the data and will return <strong>false<\/strong>. Otherwise, it will add the data to the cache.<\/li>\n\n\n\n<li><strong>wp_cache_get<\/strong> &ndash; if the cache exists, it will return its value. If it doesn&rsquo;t, the function will return <strong>false<\/strong>.<\/li>\n\n\n\n<li><strong>wp_cache_flush<\/strong> &ndash; deletes all cached content.<\/li>\n\n\n\n<li><strong>wp_cache_flush_group<\/strong> &ndash; clears all cached content in a group if the object caching settings support it. If it doesn&rsquo;t, the function will remove all cached data.<\/li>\n\n\n\n<li><strong>wp_cache_replace<\/strong> &ndash; if the cached object exists, it will substitute the content. Otherwise, it will return <strong>false<\/strong>. This function is similar to <strong>wp_cache_set()<\/strong>, except it doesn&rsquo;t add the cached object if the cache exists.<\/li>\n\n\n\n<li><strong>wp_cache_delete<\/strong> &ndash; removes data from a particular cache key.<\/li>\n\n\n\n<li><strong>wp_cache_add_non-persistent_groups<\/strong> &ndash; instructs the object caching mechanism not to copy the group or list of groups in persistent storage. This function is especially beneficial when caching content that should be available only for a one-page load. Note that only several caching plugins apply <strong>wp_cache_add_non-persistent_groups<\/strong>.<\/li>\n<\/ul><p>If you have a small and low-traffic website, the WordPress object caching feature may be enough to manage your website&rsquo;s cache.<\/p><p>However, large WordPress sites need persistent solutions that will cache objects across multiple page loads. These tools can improve your website&rsquo;s performance by speeding up the database query transfer while reducing your server&rsquo;s workload.<\/p><p>On top of that, the persistent caching mechanism can increase traffic capacity, providing a better user experience and helping you <a href=\"\/ng\/tutorials\/how-to-scale-a-business\/\">scale your business<\/a>.<\/p><p>For this reason, our <a href=\"http:\/\/higher-tier%20WordPress%20hosting%20plans\">higher-tier WordPress hosting plans<\/a>, starting at <strong>\u20a63900.00\/month<\/strong>, include the object cache feature. We use the LiteSpeed Memcache (LSMCD) system for object caching that you can <a href=\"https:\/\/support.hostinger.com\/en\/articles\/6099689-how-to-manage-object-cache-for-wordpress-websites-at-hostinger\">easily manage on hPanel<\/a> by navigating to <strong>Websites<\/strong> &rarr; <strong>Manage<\/strong>.<\/p><figure class=\"wp-block-image size-large\"><a class=\"hgr-tutorials-cta hgr-tutorials-cta-wordpress-hosting\" href=\"\/ng\/wordpress-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"2048\" height=\"600\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-111781\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=2048,fit=scale-down 2048w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1024,fit=scale-down 1024w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=768,fit=scale-down 768w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2024\/06\/New-WP_in-text-banner.png\/w=1536,fit=scale-down 1536w\" sizes=\"auto, (max-width: 2048px) 100vw, 2048px\" \/><\/a><\/figure><p>If your hosting provider doesn&rsquo;t offer a built-in WordPress object cache solution, continue reading as we explain how to install one manually.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Learn More Tips to Improve Your WordPress Site&rsquo;s Performance                <\/p>\n            <\/div>\n            <p class=\"protip__content\"><a href=\"\/ng\/tutorials\/wordpress\/how-to-clear-wordpress-cache\/\">How to Clear Cache in WordPress<\/a><br>\n<a href=\"\/ng\/tutorials\/speed-up-wordpress\/\">How to Speed Up a WordPress Website<\/a><br>\n<a href=\"\/ng\/tutorials\/litespeed-website-optimization-tool\/\">Optimizing WordPress With the LiteSpeed Cache Plugin<\/a><\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-persistent-object-caching-tools\">Persistent Object Caching Tools<\/h2><p>We&rsquo;ll compare the two most popular WordPress object caching tools on the market &ndash; Redis and Memcached.<\/p><h3 class=\"wp-block-heading\" id=\"h-redis\"><a href=\"https:\/\/redis.io\/\">Redis<\/a><\/h3><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-plugin-banner-on-WordPress.png\"><img loading=\"lazy\" decoding=\"async\" width=\"935\" height=\"299\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-plugin-banner-on-WordPress.png\/public\" alt=\"The Redis Object Cache plugin banner on WordPress\n\" class=\"wp-image-80906\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-plugin-banner-on-WordPress.png\/w=935,fit=scale-down 935w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-plugin-banner-on-WordPress.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-plugin-banner-on-WordPress.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-plugin-banner-on-WordPress.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 935px) 100vw, 935px\" \/><\/a><\/figure><\/div><p>Remote Dictionary Server (Redis) is an open-source in-memory caching solution that works with various data structures, such as strings, sets, streams, hashes, and lists. Its main goal is to reduce the load on your MySQL database.<\/p><p>Redis offers on-disk persistence, storing data in durable storage like solid-state disk (SSD) to prevent data loss. Depending on your database size, this persistent object caching mechanism provides four persistence options &ndash; Redis Database (RDB), Append Only File (AOF), no persistence, and RDB + AOF.<\/p><p>Furthermore, it comes with built-in replication that works asynchronously. This means the process is non-blocking, as the master will continue running queries while the replicas proceed with partial resynchronization or initial synchronization.<\/p><p>With Redis, you can modify an object&rsquo;s persistence by allocating time to remove and reload new data or enter which new updates to apply when you restart this tool. You can also disable the feature if one or more web pages contain dynamic content.<\/p><p>With these advanced features, Redis can handle sub-millisecond response times, dealing with millions of requests per second for real-time websites.<\/p><p>To enable object caching via Redis on your site, install the <a href=\"https:\/\/wordpress.org\/plugins\/redis-cache\/\">Redis Object Cache plugin<\/a> and open the <strong>Settings <\/strong>tab on your WordPress dashboard. Go to <strong>Redis <\/strong>&rarr; <strong>Enable Object Cache<\/strong>.<\/p><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-settings-on-WordPress.png\"><img loading=\"lazy\" decoding=\"async\" width=\"484\" height=\"321\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-settings-on-WordPress.png\/public\" alt=\"The Redis Object Cache settings on the WordPress dashboard, with the Enable Object Cache highlighted\" class=\"wp-image-80907\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-settings-on-WordPress.png\/w=484,fit=scale-down 484w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-settings-on-WordPress.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/The-Redis-Object-Cache-settings-on-WordPress.png\/w=150,fit=scale-down 150w\" sizes=\"auto, (max-width: 484px) 100vw, 484px\" \/><\/a><\/figure><\/div><p>This object caching tool also offers <a href=\"https:\/\/redis.com\/\">Redis Enterprise<\/a>, the premium solution with additional functionality and benefits, such as Role-Based Access Control (RBAC). To purchase the service, you&rsquo;ll need to fill out a form, and the Redis Enterprise team will follow up with a quote.<\/p><p>        <div class=\"protip\">\n            <div class=\"protip__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path d=\"M1.49234 23.5024C1.23229 23.5024 0.972242 23.4024 0.782206 23.2123C0.562165 22.9923 0.452144 22.6822 0.502153 22.3722C0.562165 21.9221 1.14227 17.9113 3.00262 16.351C3.63274 15.8209 4.43289 15.5509 5.26305 15.5609C6.09321 15.5909 6.87335 15.9109 7.47347 16.4911C8.6937 17.6913 8.76371 19.6717 7.6435 20.9919C6.0832 22.8523 2.08245 23.4324 1.63237 23.4924C1.59236 23.4924 1.54235 23.4924 1.50234 23.4924L1.49234 23.5024ZM5.16303 17.5613C4.84297 17.5613 4.53291 17.6713 4.29287 17.8813C3.60274 18.4614 3.07264 19.9317 2.75258 21.242C4.06282 20.9219 5.5331 20.3918 6.11321 19.7017C6.55329 19.1716 6.54329 18.3814 6.0832 17.9213C5.85316 17.7013 5.5431 17.5713 5.20304 17.5613C5.19304 17.5613 5.17303 17.5613 5.16303 17.5613ZM11.7243 21.8821C11.4942 21.8821 11.2642 21.8021 11.0841 21.652C10.8541 21.462 10.7241 21.1819 10.7241 20.8819V15.9109L8.08358 13.2705H3.11264C2.81259 13.2705 2.53254 13.1404 2.3425 12.9104C2.15246 12.6803 2.07245 12.3803 2.12246 12.0902C2.19247 11.7102 2.84259 8.36953 4.70294 7.12929C6.33325 6.04909 8.96375 6.49918 10.244 6.80923C11.5442 4.96889 13.2546 3.4286 15.2349 2.33839C17.4553 1.11816 19.9858 0.518051 22.4963 0.498047C23.0464 0.498047 23.4865 0.948132 23.4865 1.49824C23.4865 5.0389 22.3763 9.97983 17.1753 13.7605C17.4853 15.0408 17.9354 17.6613 16.8552 19.2816C15.615 21.1419 12.2744 21.7921 11.8943 21.8621C11.8343 21.8721 11.7743 21.8821 11.7143 21.8821H11.7243ZM12.7245 16.181V19.6016C13.7146 19.2916 14.7948 18.7915 15.2049 18.1814C15.675 17.4812 15.605 16.091 15.385 14.9008C14.5248 15.3808 13.6346 15.8109 12.7245 16.181ZM9.66388 12.0302L11.9643 14.3307C13.1845 13.8306 14.3648 13.2204 15.485 12.5103C19.9358 9.51974 21.2361 5.60901 21.4561 2.53843C19.6157 2.67846 17.8254 3.20856 16.2051 4.09872C14.2847 5.14892 12.6544 6.68921 11.4942 8.54956C10.7841 9.65977 10.174 10.82 9.66388 12.0302ZM4.39289 11.2701H7.81353C8.1936 10.3599 8.63368 9.46974 9.11377 8.60957C7.92355 8.38953 6.51329 8.31952 5.81315 8.78961C5.19304 9.19968 4.70294 10.3099 4.39289 11.2701Z\" fill=\"#673DE6\"\/>\n                <\/svg>\n                <p class=\"protip__title\">\n                    Pro Tip                <\/p>\n            <\/div>\n            <p class=\"protip__content\">When purchasing a managed WordPress hosting plan, don&rsquo;t forget to check whether the web host company provides a Redis server.<\/p>\n                    <\/div>\n        \n\n\n\n<\/p><h3 class=\"wp-block-heading\" id=\"h-memcached\"><a href=\"https:\/\/memcached.org\/\">Memcached<\/a><\/h3><div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><a href=\"\/ng\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/03\/Memcached_s-official-website.png\"><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"547\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/Memcached_s-official-website.png\/public\" alt=\"Memcached's official website\n\" class=\"wp-image-80908\" srcset=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/Memcached_s-official-website.png\/w=813,fit=scale-down 813w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/Memcached_s-official-website.png\/w=300,fit=scale-down 300w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/Memcached_s-official-website.png\/w=150,fit=scale-down 150w, https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/03\/Memcached_s-official-website.png\/w=768,fit=scale-down 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/a><\/figure><\/div><p>Memcached is an open-source distributed memory object caching system that optimizes dynamic content on various web applications by reducing the database load. It stores data according to key values for objects collected from API calls, page rendering, or database cache and manages them in dynamic memory or RAM.<\/p><p>Compared to Redis, Memcached is more beginner-friendly and straightforward. This object caching tool can store any data size, including a whole HTML page. Memcached allocates each object with a key, raw data, and expiration time. It can work in a standalone server or multiple servers and can be accessed via the <a href=\"\/ng\/tutorials\/tcp-protocol\/\">Transmission Control Protocol<\/a> (TCP).<\/p><p>When a browser requests data, Memcached will check if there are any similar objects cached. If yes, it will serve the saved content and send it back to the browser. If not, this tool will return a status code indicating the failure. Subsequently, the server will query the database and send it to Memcached.<\/p><p>Memcached will automatically update the object cache and load the latest data when you update or remove content. If your server runs out of space, the older data will be overwritten. However, if you restart the server, the cached objects are removed. Until Memcached rebuilds the cache, your server may experience an increased load.<\/p><p>As this object caching tool doesn&rsquo;t have a specific WordPress plugin, you will have to install a compatible extension like <a href=\"\/ng\/tutorials\/wp-super-cache-vs-w3-total-cache\/\">WP Super Cache or W3 Total Cache<\/a> to enable it on your site.<\/p><p><div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> Before downloading the plugin, you must install Memcached on your server or activate it via the <strong>PHP Options<\/strong> menu. With the latter option, ensure your hosting provider supports the extension.\n            <\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p>Object caching involves storing database queries on the server. This way, when a browser sends a similar request, the server delivers the cached objects instead of fetching the content from scratch.<\/p><p>Object cache can optimize a website&rsquo;s performance, improving its user experience. On top of that, enabling it can decrease your server load by reducing repeated queries, thus increasing the response time.<\/p><p>The built-in WordPress object caching feature is enabled on your website by default. However, it only caches content on a single page load and is suitable for a small-scale website. If you run a high-traffic site, it&rsquo;s best to use a persistent object caching tool like Redis or Memcached, as they can work on multiple page loads.<\/p><p>Before installing a tool, check with your hosting provider if they don&rsquo;t have a built-in object cache feature and support your chosen one. If you have any questions or suggestions, please leave them in the comment section below.<\/p><h2 class=\"wp-block-heading\" id=\"h-what-is-object-cache-faq\">What Is Object Cache FAQ<\/h2><p>To help you understand more about an object cache, we will answer some common questions about it.<\/p><div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1678900933499\"><h3 class=\"schema-faq-question\">Can I Use Object Caching With Other Caching Methods?<\/h3> <p class=\"schema-faq-answer\">Yes, but we recommend having one caching method for your site to ensure only one tool caches the database. If you need to enable more caching tools, ensure the configurations complement one another to prevent software conflicts. Furthermore, avoid running redundant or opposite actions, as it can lead to the plugins not working properly.&nbsp;&nbsp;<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1678900941409\"><h3 class=\"schema-faq-question\">What&rsquo;s the Difference Between an Object Cache and a Page Cache?<\/h3> <p class=\"schema-faq-answer\">Page caching is a client-side caching system that stores the entire rendered page, including HTML and content, in the server&rsquo;s hard disk memory. On the other hand, the object cache is a server-side caching method that keeps database query results on the server.&nbsp;<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1678900950977\"><h3 class=\"schema-faq-question\">Why Use an Object Cache Over an HTTP Cache?<\/h3> <p class=\"schema-faq-answer\">Suppose you want to secure your website by implementing user authentication as a security layer. In that case, an object cache is a safer option as it stores customers&rsquo; data on the server level. In comparison, an HTTP cache, especially the shared cache, isn&rsquo;t as secure and may make your customers prone to cyber threats like brute force attacks.<\/p> <\/div> <div class=\"schema-faq-section\" id=\"faq-question-1678900959293\"><h3 class=\"schema-faq-question\">Is a Caching Plugin Necessary, or Is the WordPress Cache Enough?<\/h3> <p class=\"schema-faq-answer\">This depends on your website size. The WordPress cache is better if you own a small site with low traffic. On the other hand, if your website is resource-heavy and has many visitors, we recommend adding an object caching plugin, as it can help optimize your server and boost its performance.<\/p> <\/div> <\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you are looking for website optimization options, consider utilizing an object cache. A WordPress website consists of many PHP objects that are constantly built, initiated, and removed by the memory manager. However, these actions may overload your server, causing your site to slow down and experience errors. An unresponsive website will result in a [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/ng\/tutorials\/what-is-object-cache\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":298,"featured_media":144154,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"What Is Object Cache and How to Enable It on WordPress","rank_math_description":"Object caching is server-side caching; it stores data on the server rather than the browser. Check this article to learn how to enable it.","rank_math_focus_keyword":"what is object cache","footnotes":""},"categories":[22602],"tags":[],"class_list":["post-80903","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-performance-optimization"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/what-is-object-cache","default":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/object-cache","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/tutoriels\/cache-objet-wordpress","default":0},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/tutoriales\/que-es-la-cache-de-objetos","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/tutorial\/object-cache-adalah","default":0},{"locale":"de-DE","link":"https:\/\/www.hostinger.com\/de\/tutorials\/persistent-objekt-cache","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/what-is-object-cache","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/what-is-object-cache-in-wordpress-how-it-works-different-types-and-how-to-enable-it","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/what-is-object-cache-in-wordpress-how-it-works-different-types-and-how-to-enable-it","default":0},{"locale":"es-MX","link":"https:\/\/www.hostinger.com\/mx\/tutoriales\/que-es-la-cache-de-objetos","default":0},{"locale":"es-CO","link":"https:\/\/www.hostinger.com\/co\/tutoriales\/que-es-la-cache-de-objetos","default":0},{"locale":"es-AR","link":"https:\/\/www.hostinger.com\/ar\/tutoriales\/que-es-la-cache-de-objetos","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/object-cache","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/what-is-object-cache","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/what-is-object-cache","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/what-is-object-cache","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/what-is-object-cache","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/80903","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/users\/298"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/comments?post=80903"}],"version-history":[{"count":26,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/80903\/revisions"}],"predecessor-version":[{"id":144153,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/posts\/80903\/revisions\/144153"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media\/144154"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/media?parent=80903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/categories?post=80903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/ng\/tutorials\/wp-json\/wp\/v2\/tags?post=80903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}