{"id":1355,"date":"2025-11-05T12:34:56","date_gmt":"2025-11-05T09:34:56","guid":{"rendered":"https:\/\/www.dchost.com\/blog\/redis-vs-memcached-for-wordpress-woocommerce-the-ttl-and-eviction-tuning-playbook-i-wish-i-had\/"},"modified":"2026-11-04T01:41:36","modified_gmt":"2026-11-03T22:41:36","slug":"redis-vs-memcached-wordpress-woocommerce","status":"publish","type":"post","link":"https:\/\/www.dchost.com\/blog\/en\/redis-vs-memcached-wordpress-woocommerce\/","title":{"rendered":"Redis vs Memcached for WordPress and WooCommerce"},"content":{"rendered":"<div class=\"dchost-blog-content-wrapper\"><p>A WooCommerce store can be quick for anonymous visitors yet slow when customers log in or change their carts. Object caching is one possible part of that difference, alongside database queries, PHP workers and plugin behavior. This guide compares Redis and Memcached for WordPress and WooCommerce, then explains how expiration, invalidation and memory eviction affect performance and correctness. The aim is to choose a supported backend and tune it from measurements, rather than assume that a particular cache or short TTL fixes every slow page. Examples below describe possible configurations, not measured results from a customer deployment.<\/p>\n<p>WordPress and WooCommerce repeatedly fetch settings, product information and other reusable data. A persistent object cache can reduce those database calls between requests. It is separate from full-page HTML caching, and it is not the authoritative store for orders or customer sessions. Both Redis and Memcached require an appropriate WordPress drop-in and a plan for cache misses, invalidation and service failures. A higher hit ratio is useful only when the returned data still belongs to the correct user and reflects the changes the application requires.<\/p>\n<div id=\"toc_container\" role=\"navigation\" aria-label=\"Table of Contents\" data-nosnippet class=\"toc_transparent no_bullets toc_numbered toc_title_center\"><p class=\"toc_title\">\u0130\u00e7indekiler<\/p><ul class=\"toc_list\"><li><a href=\"#What_a_Persistent_Object_Cache_Does\"><span class=\"toc_number toc_depth_1\">1.<\/span> What a Persistent Object Cache Does<\/a><\/li><li><a href=\"#Redis_and_Memcached_Capabilities\"><span class=\"toc_number toc_depth_1\">2.<\/span> Redis and Memcached Capabilities<\/a><\/li><li><a href=\"#Choose_TTLs_and_Invalidation_Rules\"><span class=\"toc_number toc_depth_1\">3.<\/span> Choose TTLs and Invalidation Rules<\/a><ul><li><a href=\"#Define_Acceptable_Staleness\"><span class=\"toc_number toc_depth_2\">3.1.<\/span> Define Acceptable Staleness<\/a><\/li><li><a href=\"#How_Transients_Use_the_Object_Cache\"><span class=\"toc_number toc_depth_2\">3.2.<\/span> How Transients Use the Object Cache<\/a><\/li><li><a href=\"#Cache_Groups_and_Drop-in_Support\"><span class=\"toc_number toc_depth_2\">3.3.<\/span> Cache Groups and Drop-in Support<\/a><\/li><li><a href=\"#Invalidate_Cached_Results_on_Updates\"><span class=\"toc_number toc_depth_2\">3.4.<\/span> Invalidate Cached Results on Updates<\/a><\/li><li><a href=\"#Choosing_an_Initial_TTL\"><span class=\"toc_number toc_depth_2\">3.5.<\/span> Choosing an Initial TTL<\/a><\/li><\/ul><\/li><li><a href=\"#Configure_Memory_Limits_and_Eviction\"><span class=\"toc_number toc_depth_1\">4.<\/span> Configure Memory Limits and Eviction<\/a><ul><li><a href=\"#Eviction_Under_Memory_Pressure\"><span class=\"toc_number toc_depth_2\">4.1.<\/span> Eviction Under Memory Pressure<\/a><\/li><li><a href=\"#Redis_Eviction_Policies_for_Cache-Only_Workloads\"><span class=\"toc_number toc_depth_2\">4.2.<\/span> Redis Eviction Policies for Cache-Only Workloads<\/a><\/li><li><a href=\"#Memcached_Item_Sizes_and_Slab_Management\"><span class=\"toc_number toc_depth_2\">4.3.<\/span> Memcached Item Sizes and Slab Management<\/a><\/li><li><a href=\"#Plan_for_an_Empty_Cache\"><span class=\"toc_number toc_depth_2\">4.4.<\/span> Plan for an Empty Cache<\/a><\/li><\/ul><\/li><li><a href=\"#Persistence_Restarts_and_High_Availability\"><span class=\"toc_number toc_depth_1\">5.<\/span> Persistence, Restarts and High Availability<\/a><ul><li><a href=\"#Cross-Request_Reuse_and_Restart_Recovery\"><span class=\"toc_number toc_depth_2\">5.1.<\/span> Cross-Request Reuse and Restart Recovery<\/a><\/li><li><a href=\"#Cache_Availability_and_Client_Failure_Handling\"><span class=\"toc_number toc_depth_2\">5.2.<\/span> Cache Availability and Client Failure Handling<\/a><\/li><li><a href=\"#Separate_Workloads_with_Different_Requirements\"><span class=\"toc_number toc_depth_2\">5.3.<\/span> Separate Workloads with Different Requirements<\/a><\/li><\/ul><\/li><li><a href=\"#Example_Configuration_and_Validation\"><span class=\"toc_number toc_depth_1\">6.<\/span> Example Configuration and Validation<\/a><ul><li><a href=\"#Redis_Settings_for_a_Dedicated_Cache_Instance\"><span class=\"toc_number toc_depth_2\">6.1.<\/span> Redis Settings for a Dedicated Cache Instance<\/a><\/li><li><a href=\"#Memcached_Configuration_Flags\"><span class=\"toc_number toc_depth_2\">6.2.<\/span> Memcached Configuration Flags<\/a><\/li><li><a href=\"#WordPress_Drop-in_Configuration\"><span class=\"toc_number toc_depth_2\">6.3.<\/span> WordPress Drop-in Configuration<\/a><\/li><li><a href=\"#Measure_Cache_and_Application_Behavior\"><span class=\"toc_number toc_depth_2\">6.4.<\/span> Measure Cache and Application Behavior<\/a><\/li><li><a href=\"#Deployment_and_Cache_Invalidation\"><span class=\"toc_number toc_depth_2\">6.5.<\/span> Deployment and Cache Invalidation<\/a><\/li><\/ul><\/li><li><a href=\"#When_to_Choose_Redis_When_to_Choose_Memcached\"><span class=\"toc_number toc_depth_1\">7.<\/span> When to Choose Redis, When to Choose Memcached<\/a><\/li><li><a href=\"#Common_Cache_Configuration_Mistakes\"><span class=\"toc_number toc_depth_1\">8.<\/span> Common Cache Configuration Mistakes<\/a><ul><li><a href=\"#Incorrect_Context_or_Invalidation_for_Personalized_Data\"><span class=\"toc_number toc_depth_2\">8.1.<\/span> Incorrect Context or Invalidation for Personalized Data<\/a><\/li><li><a href=\"#Volatile_Policies_with_Non-Expiring_Keys\"><span class=\"toc_number toc_depth_2\">8.2.<\/span> Volatile Policies with Non-Expiring Keys<\/a><\/li><li><a href=\"#Values_Above_the_Memcached_Item-Size_Limit\"><span class=\"toc_number toc_depth_2\">8.3.<\/span> Values Above the Memcached Item-Size Limit<\/a><\/li><li><a href=\"#Mixing_Workloads_in_One_Redis_Instance\"><span class=\"toc_number toc_depth_2\">8.4.<\/span> Mixing Workloads in One Redis Instance<\/a><\/li><li><a href=\"#Other_Application_Bottlenecks\"><span class=\"toc_number toc_depth_2\">8.5.<\/span> Other Application Bottlenecks<\/a><\/li><\/ul><\/li><li><a href=\"#Official_Documentation\"><span class=\"toc_number toc_depth_1\">9.<\/span> Official Documentation<\/a><\/li><li><a href=\"#Selection_and_Validation_Checklist\"><span class=\"toc_number toc_depth_1\">10.<\/span> Selection and Validation Checklist<\/a><\/li><\/ul><\/div>\n<h2 id=\"section-1\"><span id=\"What_a_Persistent_Object_Cache_Does\">What a Persistent Object Cache Does<\/span><\/h2>\n<p>In WordPress, <strong>persistent object cache<\/strong> means that cached objects can live <em>beyond a single HTTP request<\/em>. It does not mean that they are saved to disk forever or guaranteed to survive a service restart. A Redis or Memcached drop-in can reuse objects across page loads instead of asking MySQL for the same values again. Actual gains depend on the workload, network overhead and how effectively the application uses the cache. A cold or unavailable cache also needs to be handled correctly.<\/p>\n<p>WordPress repeatedly requests options, user metadata, terms and product data. Reusing suitable cached results can reduce repeated database work, but stock, tax, shipping and other changing results still need the correct context and invalidation. How often a value changes is one selection criterion; correctness and the cost of rebuilding it also matter.<\/p>\n<p>OPcache stores compiled PHP bytecode; an object cache stores reusable application data. They address different work and may both help a WordPress installation. For the broader relationship between PHP-FPM, OPcache, Redis and database tuning, see <a href=\"https:\/\/www.dchost.com\/blog\/en\/wordpress-server-tuning-php-redis-mysql\/\">the server-side WordPress optimization guide<\/a>. Here, the focus is choosing and operating the object-cache backend.<\/p>\n<h2 id=\"section-2\"><span id=\"Redis_and_Memcached_Capabilities\">Redis and Memcached Capabilities<\/span><\/h2>\n<p>Redis and Memcached can both serve the WordPress object-cache role, but their configuration and failure behavior differ. Memcached concentrates on in-memory key\/value storage and uses multiple worker threads. Redis adds data structures, configurable eviction policies and optional persistence and replication. A WordPress drop-in may only use a subset of these capabilities, so choose based on its supported features and the operational requirements of the store.<\/p>\n<p>Memcached is commonly used as an ephemeral cache for values such as serialized WordPress data. A normal cold restart can leave that cache empty, and the application must be able to rebuild missing entries from authoritative data. It is a practical choice when the existing stack supports it well and the team wants a focused cache service. Do not assume that a missing cache entry and an unreachable cache server produce the same behavior: connection failures depend on the client and drop-in implementation.<\/p>\n<p>Redis offers richer data structures, optional persistence, replication and several eviction policies. Command execution is largely serialized, while background work and I\/O threading vary by version and configuration. For WordPress object caching, useful controls include memory limits and policies such as approximate LRU or LFU. Those policies can retain frequently reused catalog data under pressure, but no policy guarantees a particular hit ratio or response time. Measure the store\u2019s access pattern before choosing.<\/p>\n<p>The decision starts with a maintained drop-in, compatible PHP client and an accessible cache service. Memcached may fit a simple in-memory deployment; Redis may fit a team that needs more eviction and replication controls. Neither backend automatically improves every page. Compare query counts, response times, memory use and correctness under the same workload, including a product update and an empty-cache condition.<\/p>\n<h2 id=\"section-3\"><span id=\"Choose_TTLs_and_Invalidation_Rules\">Choose TTLs and Invalidation Rules<\/span><\/h2>\n<h3><span id=\"Define_Acceptable_Staleness\">Define Acceptable Staleness<\/span><\/h3>\n<p>Consider a store that imports new prices and stock overnight. If a custom cached query is not invalidated by that import, visitors may continue to receive yesterday\u2019s result until it expires. This is a possible failure scenario, not a measured customer incident. Choose expiration based on how much staleness the particular result can tolerate, and invalidate results when their underlying data changes. Shortening TTL can limit some stale results but does not replace correct update handling.<\/p>\n<p>Separate reusable catalog results, site configuration, personalized output and authoritative session data. A custom catalog query may tolerate a short reuse period with invalidation on product changes. Core options and WooCommerce data already have cache lifecycles that should not be overridden blindly. Personalized results require the correct customer, language, currency, tax and other relevant context in their keys. Cart or session records must remain under WooCommerce\u2019s supported storage and update behavior; they are not disposable fragments to protect by setting a one-minute TTL.<\/p>\n<h3><span id=\"How_Transients_Use_the_Object_Cache\">How Transients Use the Object Cache<\/span><\/h3>\n<p>WordPress transients express an upper expiration time for cached values. With an external object cache, they can be stored through that backend; otherwise WordPress uses the database. They may disappear before the chosen expiration, so the application must regenerate a missing value. For a costly product filter result, a few minutes may be a useful experiment if product updates also invalidate it. Expiration alone does not make cached stock or prices authoritative, and a transient must not become the only copy of business data.<\/p>\n<h3><span id=\"Cache_Groups_and_Drop-in_Support\">Cache Groups and Drop-in Support<\/span><\/h3>\n<p>WordPress core uses cache groups for data such as options, user metadata and terms; WooCommerce adds its own data access and invalidation behavior. A group name does not itself provide a configurable TTL or a Redis eviction priority. Some groups are intentionally non-persistent, and support for flushing a group varies by drop-in. Preserve the existing lifecycles unless a documented customization is needed. For custom results, determine which writes invalidate them and how the result is reconstructed after a miss.<\/p>\n<h3><span id=\"Invalidate_Cached_Results_on_Updates\">Invalidate Cached Results on Updates<\/span><\/h3>\n<p>Use WordPress and WooCommerce data APIs so that their normal cache invalidation runs when records change. A generic cache backend does not understand every custom product query or raw database update. When adding a transient or other custom cached result, connect invalidation to all events that change that result, including imports and relevant settings. Validate that the hooks actually fire in the store\u2019s update paths. Correct invalidation allows useful reuse without relying on an arbitrary universal TTL.<\/p>\n<h3><span id=\"Choosing_an_Initial_TTL\">Choosing an Initial TTL<\/span><\/h3>\n<p>For an illustrative custom catalog result that is safe to reuse and invalidates on updates, five to fifteen minutes can be a starting experiment. This is not a global WordPress setting or a recommendation for cart\/session data. Set a tolerance for staleness, measure reuse and rebuild cost, then adjust that one result. Do not lengthen core option TTLs or shorten user groups just to follow a table. During a sale, unnecessarily short expirations can increase database pressure precisely when capacity is scarce.<\/p>\n<h2 id=\"section-4\"><span id=\"Configure_Memory_Limits_and_Eviction\">Configure Memory Limits and Eviction<\/span><\/h2>\n<h3><span id=\"Eviction_Under_Memory_Pressure\">Eviction Under Memory Pressure<\/span><\/h3>\n<p>When cache memory fills, eviction determines which eligible entries can be removed before their TTL expires. Traffic spikes can increase memory pressure and cache misses. Choose a policy that fits the access pattern and confirm that every evictable value can be reconstructed from authoritative data.<\/p>\n<h3><span id=\"Redis_Eviction_Policies_for_Cache-Only_Workloads\">Redis Eviction Policies for Cache-Only Workloads<\/span><\/h3>\n<p>For a Redis instance containing only reconstructable cache data, <strong>allkeys-lfu<\/strong> favors frequently accessed keys and <strong>allkeys-lru<\/strong> favors recently accessed keys, using approximate algorithms. Neither policy recognizes WordPress groups as intrinsically important. Volatile policies consider only keys with expiration, and writes may fail if too little eligible data remains to reclaim memory. Choose from actual access patterns and monitor misses and evictions; do not apply an allkeys policy to the only copy of session or queue data.<\/p>\n<p>Set <strong>maxmemory<\/strong> with headroom for Redis overhead, the operating system and other services; a host or container limit is not the same as Redis\u2019s memory setting. Check the configured policy and available capacity together. The official documentation explains <a href=\"https:\/\/redis.io\/docs\/latest\/develop\/reference\/eviction\/\" rel=\"nofollow noopener\" target=\"_blank\">Redis eviction policies and their selection criteria<\/a>.<\/p>\n<h3><span id=\"Memcached_Item_Sizes_and_Slab_Management\">Memcached Item Sizes and Slab Management<\/span><\/h3>\n<p>Memcached uses slab classes and LRU-based mechanisms to manage stored items. Values above its configured item-size limit are rejected; automatic chunking, if any, is a client-specific behavior and must not be assumed. Check storage failures and typical serialized value sizes before raising <code>-I<\/code>. The <code>-m<\/code> option controls item-storage memory, not a strict cap on total process memory. LRU and slab-maintenance options depend on the installed version. See the <a href=\"https:\/\/github.com\/memcached\/memcached\/wiki\/ConfiguringServer\" rel=\"nofollow noopener\" target=\"_blank\">Memcached server configuration notes<\/a> and confirm local defaults before changing them.<\/p>\n<h3><span id=\"Plan_for_an_Empty_Cache\">Plan for an Empty Cache<\/span><\/h3>\n<p>An empty object cache may temporarily increase database work after a restart. A gradual, rate-limited warm-up can help, using safe anonymous requests to representative public pages or targeted application queries. A page served entirely from an HTML cache may not warm its object-cache path. Exclude cart, checkout, account and any state-changing endpoints, and avoid replaying customer sessions. Measure whether a warm-up actually reduces the workload that matters rather than adding a second burst of traffic.<\/p>\n<h2 id=\"section-5\"><span id=\"Persistence_Restarts_and_High_Availability\">Persistence, Restarts and High Availability<\/span><\/h2>\n<h3><span id=\"Cross-Request_Reuse_and_Restart_Recovery\">Cross-Request Reuse and Restart Recovery<\/span><\/h3>\n<p>WordPress persistence refers to reuse across requests, not guaranteed restart recovery. Memcached is normally treated as an ephemeral cache; Redis can optionally save RDB snapshots or AOF logs. For a Redis instance holding only reconstructable object-cache data, disabling persistence may be appropriate, provided the database can handle a cold rebuild. For sessions, queues or other state, decide durability separately. Do not disable persistence on a shared instance without first identifying every workload stored there.<\/p>\n<h3><span id=\"Cache_Availability_and_Client_Failure_Handling\">Cache Availability and Client Failure Handling<\/span><\/h3>\n<p>High availability depends on more than whether cached data can be rebuilt. An unreachable cache server may trigger connection errors or delays, depending on the WordPress drop-in. Redis replicas and Sentinel can provide failover when the client supports them, but asynchronous replication can lose recent updates and requires careful invalidation behavior. A Memcached node pool also needs compatible client hashing and failure handling. Test cache outages, recovery and stale-data behavior in staging before relying on either arrangement for a store.<\/p>\n<h3><span id=\"Separate_Workloads_with_Different_Requirements\">Separate Workloads with Different Requirements<\/span><\/h3>\n<p>Object cache, sessions and queues often need different durability and eviction rules. Separate Redis instances can give them independent memory limits and policies. Selecting different logical databases within one Redis instance only separates key namespaces; they still share process resources and the instance\u2019s eviction configuration. Logical databases do not provide a per-application memory boundary. Design the separation so a queue surge cannot consume the capacity assumed by the object-cache service.<\/p>\n<h2 id=\"section-6\"><span id=\"Example_Configuration_and_Validation\">Example Configuration and Validation<\/span><\/h2>\n<h3><span id=\"Redis_Settings_for_a_Dedicated_Cache_Instance\">Redis Settings for a Dedicated Cache Instance<\/span><\/h3>\n<p>The following is an illustrative excerpt for a dedicated, reconstructable object-cache instance. The 2 GB value is an example allocation, not a recommendation to give Redis half of every server. Confirm available memory, other services, connection security and the cost of rebuilding an empty cache before applying it. Inline explanatory comments are placed on separate lines so they cannot be parsed as extra directive arguments.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\"># redis.conf excerpt: cache-only instance\nmaxmemory 2gb\nmaxmemory-policy allkeys-lfu\n# Disable AOF only for reconstructable cache data.\nappendonly no\n# Disable RDB snapshotting only for this cache-only instance.\nsave &quot;&quot;\nlatency-monitor-threshold 100\n<\/code><\/pre>\n<p>Leave headroom for Redis overhead, replication or persistence buffers where used, the operating system and other services. A container limit is not the same as <code>maxmemory<\/code>. Monitor <code>used_memory<\/code>, RSS, <code>evicted_keys<\/code>, hits and misses through <code>INFO<\/code>; use latency-monitor or application metrics for latency. Rising evictions can indicate capacity pressure, but the response should depend on reuse and workload. Large serialized values, expensive commands and rebuilding too many keys at once may need application changes rather than a longer TTL.<\/p>\n<h3><span id=\"Memcached_Configuration_Flags\">Memcached Configuration Flags<\/span><\/h3>\n<p>This foreground example is for an unprivileged service account on a host where the application connects locally. It binds TCP to loopback, disables UDP explicitly, allocates an illustrative 2 GB for items and permits items up to 2 MB. Size these values for the workload and check <code>memcached -h<\/code> for the installed version. A packaged system service usually expresses the same settings in its service configuration.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">memcached -l 127.0.0.1 -p 11211 -U 0 -m 2048 -I 2m -t 4\n<\/code><\/pre>\n<p>The <code>-t<\/code> flag sets worker threads; more threads do not guarantee faster responses. Modern versions already enable several maintenance behaviors that older examples list explicitly. Monitor <code>get_hits<\/code>, <code>get_misses<\/code>, <code>evictions<\/code>, storage errors and slab behavior through the Memcached protocol. Large, rarely reused values can consume capacity without useful hits, so increasing the item-size limit is not always the answer. Keep the service on trusted interfaces and budget for process overhead beyond the <code>-m<\/code> allocation.<\/p>\n<h3><span id=\"WordPress_Drop-in_Configuration\">WordPress Drop-in Configuration<\/span><\/h3>\n<p>A working setup needs a maintained <code>object-cache.php<\/code> drop-in, the required PHP client and an accessible backend. The Redis snippet below uses the Redis Object Cache plugin\u2019s documented constants; they are not universal WordPress settings. Memcached drop-ins have different connection and prefix formats, so use the selected implementation\u2019s documentation instead of copying a generic <code>$memcached_servers<\/code> array. Enabling <code>WP_CACHE<\/code> alone does not establish either backend.<\/p>\n<pre class=\"language-bash line-numbers\"><code class=\"language-bash\">\/\/ wp-config.php: Redis Object Cache plugin example\n\/\/ Install and enable its object-cache.php drop-in separately.\ndefine(&#039;WP_REDIS_HOST&#039;, &#039;127.0.0.1&#039;);\ndefine(&#039;WP_REDIS_PORT&#039;, 6379);\ndefine(&#039;WP_REDIS_PREFIX&#039;, &#039;store_prod_&#039;);\n\/\/ WP_REDIS_MAXTTL is a plugin-wide upper limit, not a cart\/catalog policy.\n\/\/ Memcached: use your chosen drop-in&#039;s documented server and prefix settings.\n<\/code><\/pre>\n<p>The Redis plugin documents <code>WP_REDIS_PREFIX<\/code> as the replacement for <code>WP_CACHE_KEY_SALT<\/code>. Prefixes help prevent key collisions; they do not provide access isolation or protection from a broad flush. Group-specific expiration and ignored-group settings depend on the drop-in. Keep core and WooCommerce lifecycles intact, and confirm <code>wp_cache_supports('flush_group')<\/code> before using group-flush functionality. Do not infer that an options or sessions group should have a particular TTL merely from its name.<\/p>\n<h3><span id=\"Measure_Cache_and_Application_Behavior\">Measure Cache and Application Behavior<\/span><\/h3>\n<p>Track hit ratio, evictions, cache connection errors and application response-time percentiles alongside database query work. <code>redis-cli INFO<\/code> provides Redis server statistics; Memcached exposes <code>stats<\/code> through its protocol, not a shell command named <code>memcached stats<\/code>. Compare counter deltas over consistent intervals, since cumulative totals include earlier workloads. Use drop-in or APM data for WordPress group-level behavior. Verify price updates, coupons and separate customer sessions as functional checks alongside those performance measurements.<\/p>\n<h3><span id=\"Deployment_and_Cache_Invalidation\">Deployment and Cache Invalidation<\/span><\/h3>\n<p>If a deployment changes serialized values or key structure, prefer versioned application keys or targeted invalidation supported by the drop-in. A broad cache flush can affect other sites sharing the service and can create a database spike; it is not automatically gentle. If warm-up is useful, make rate-limited anonymous requests to safe public catalog paths that actually execute the application. Exclude checkout, cart, account and state-changing requests, and plan how the old and new application versions coexist during deployment.<\/p>\n<h2 id=\"section-7\"><span id=\"When_to_Choose_Redis_When_to_Choose_Memcached\">When to Choose Redis, When to Choose Memcached<\/span><\/h2>\n<p>Consider two hypothetical stores. A modest catalog with a well-supported Memcached drop-in may benefit from the team\u2019s existing experience operating a simple in-memory service. A larger catalog with a strongly skewed access pattern may justify evaluating Redis LFU against LRU under representative traffic. These are selection scenarios, not customer case studies or promised results. In either store, verify updates and cache outages before concluding that the chosen backend is a good fit.<\/p>\n<p>Memcached can be appropriate when a focused cache service and the available drop-in meet the requirements. Redis adds controls for eviction and optional replication and persistence, but those controls bring decisions about topology and failure behavior. Compatibility, measured reuse, available memory and the team\u2019s operating knowledge matter more than a universal speed ranking. The wrong integration can cause errors with either backend even if the underlying cache service is fast.<\/p>\n<h2 id=\"section-8\"><span id=\"Common_Cache_Configuration_Mistakes\">Common Cache Configuration Mistakes<\/span><\/h2>\n<h3><span id=\"Incorrect_Context_or_Invalidation_for_Personalized_Data\">Incorrect Context or Invalidation for Personalized Data<\/span><\/h3>\n<p>A personalized free-shipping message can become stale when the cart, address or promotion changes. A short TTL only shortens some stale periods; it does not correct a missing customer context or invalidation event. Include the relevant context in custom keys and invalidate on changes, or keep the fragment out of shared caching. Confirm behavior with at least two independent customer sessions.<\/p>\n<h3><span id=\"Volatile_Policies_with_Non-Expiring_Keys\">Volatile Policies with Non-Expiring Keys<\/span><\/h3>\n<p>Redis volatile policies only consider keys with expiration. If non-expiring keys consume the available memory and eligible keys cannot free enough space, write operations can fail. Monitor memory and application errors rather than assuming the policy protects important data. An allkeys policy is an option for reconstructable cache-only workloads; move authoritative sessions or queues to an appropriate separate service instead of making them eligible for arbitrary eviction.<\/p>\n<h3><span id=\"Values_Above_the_Memcached_Item-Size_Limit\">Values Above the Memcached Item-Size Limit<\/span><\/h3>\n<p>A serialized value above the configured Memcached item-size limit can fail to store. Inspect storage failures and value sizes before changing <code>-I<\/code>. Reducing an unnecessarily large cached result may use memory more effectively than increasing the limit for every slab profile. Treat cache misses as normal and ensure the application can compute the result without silently relying on a successful write.<\/p>\n<h3><span id=\"Mixing_Workloads_in_One_Redis_Instance\">Mixing Workloads in One Redis Instance<\/span><\/h3>\n<p>Keep workloads with different durability and eviction requirements in separate Redis instances where needed. Logical database numbers and key prefixes are useful namespacing tools, but neither creates an independent memory quota or makes session data safe from instance-wide eviction. Inventory the workloads before changing persistence or performing a service-wide flush.<\/p>\n<h3><span id=\"Other_Application_Bottlenecks\">Other Application Bottlenecks<\/span><\/h3>\n<p>A low cache hit ratio is not the only possible bottleneck. Exhausted PHP workers, database contention, slow external requests and overly large application objects can limit gains. Compare the same workload before and after one change, and consult the linked server-side tuning guide for related layers. Do not use a performance improvement to overlook incorrect prices, stale updates or cross-customer output.<\/p>\n<h2 id=\"section-9\"><span id=\"Official_Documentation\">Official Documentation<\/span><\/h2>\n<p>Consult the <a href=\"https:\/\/developer.wordpress.org\/reference\/classes\/wp_object_cache\/\" rel=\"nofollow noopener\" target=\"_blank\">WordPress object-cache reference<\/a>, <a href=\"https:\/\/redis.io\/docs\/latest\/develop\/reference\/eviction\/\" rel=\"nofollow noopener\" target=\"_blank\">Redis eviction documentation<\/a> and <a href=\"https:\/\/github.com\/memcached\/memcached\/wiki\/ConfiguringServer\" rel=\"nofollow noopener\" target=\"_blank\">Memcached configuration notes<\/a>. Check those references against the installed versions and the selected WordPress drop-in before changing settings.<\/p>\n<h2 id=\"section-10\"><span id=\"Selection_and_Validation_Checklist\">Selection and Validation Checklist<\/span><\/h2>\n<p>A persistent object cache can reduce repeated database work when the application uses it correctly. Redis offers configurable eviction and optional durability and replication; Memcached offers a focused in-memory backend. Start with a maintained, compatible drop-in and an understanding of which data can be reconstructed. Then measure response times, database load, misses and errors under representative store activity rather than choosing from generic speed claims.<\/p>\n<p>For custom cached results, choose TTL from acceptable staleness and invalidation behavior. Keep cart, checkout and account HTML out of shared full-page caching, and preserve WooCommerce\u2019s session and update logic. On a dedicated Redis cache instance, evaluate an allkeys policy with memory headroom; disable persistence only when every stored value is reconstructable. On Memcached, size item storage and item limits from observed data and restrict network access. Finally, validate cold starts, outages and recovery without replaying customer checkout actions.<\/p>\n<p>Before rollout, record the selected backend, drop-in version, memory allocation and rollback procedure. Run the same product-update, coupon and customer-isolation checks after deployment. An improvement is useful only when the store remains correct as well as responsive.<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Choose a persistent object cache for WordPress and WooCommerce. Compare Redis and Memcached, tune TTL and eviction, and preserve correct cart behavior through invalidation, isolation and supported configuration.<\/p>\n","protected":false},"author":1,"featured_media":6512,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[184],"tags":[],"class_list":["post-1355","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/1355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/comments?post=1355"}],"version-history":[{"count":2,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/1355\/revisions"}],"predecessor-version":[{"id":6798,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/posts\/1355\/revisions\/6798"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media\/6512"}],"wp:attachment":[{"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/media?parent=1355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/categories?post=1355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dchost.com\/blog\/en\/wp-json\/wp\/v2\/tags?post=1355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}