Last updated on

Object caching is a powerful technique used to significantly improve the speed and performance of websites. Much like Database caching, it works by storing frequently accessed data from your database in memory, instead of retrieving it from the database every time it’s needed. Unlike Database caching, Object Caching goes a step further and caches the resulting objects of a query rather than just the query itself. This significantly reduces the load on your server and speeds up page loading times for your users.

Visualizing Object Caching

Understanding the difference between Database Caching can be tricky as they are very similar in nature. Imagine instead of a website a construction site.

  1. Standard Without Caching (No caching): This is akin to showing up at the construction site and needing to gather all the materials and resources (wood, windows, bricks, etc.) needed to build the house from scratch. Each time you need something, you have to go out and fetch it, which can be time-consuming and inefficient.
  2. Database (DB) Caching (Having supplies ready at the site): DB caching involves storing frequently accessed database queries and their results in memory for faster retrieval. This is like having some of the supplies and building materials readily available at the construction site, reducing the need to go out and fetch them repeatedly. It speeds up the construction process by eliminating the need to repeatedly query the database for the same information.
  3. Object Caching (Having pre-built walls to snap together): Object caching takes optimization a step further. It involves caching entire objects or components of a webpage in memory. This would be like having pre-built walls, windows, doors, and other components of the house ready to assemble. With object caching, instead of constructing each element of the webpage from scratch every time it’s requested, the pre-built components are retrieved from cache and assembled, significantly reducing the time and resources required to generate the webpage.

Advanced

Default lifetime of cache objects

Default Value: 180 seconds

This setting sets the default timeframe in which cached objects remain stored in memory before being considered outdated and refreshed. A longer lifetime improves performance by serving cached content quicker, reducing database queries and server load. However, too long a lifetime can lead to outdated data being served to users. On the other hand a shorter lifetime ensures users receive the latest data, but results in more frequent database queries and potentially slightly slower loading times.

Choosing the right value:

  • High-traffic sites: For websites with frequent updates and high traffic, a shorter lifetime is recommended to ensure data freshness. The default value is recommended for these sites.
  • Low-traffic sites: For less frequently updated sites with lower traffic, a longer lifetime (such as 7200 seconds) might be acceptable, balancing performance and freshness.

Garbage collection interval

Default Value: 3600 seconds

This setting defines the time interval at which W3 Total Cache scans for and removes expired object cache data stored on disk. This ensures that outdated data doesn’t accumulate and unnecessarily occupy disk space.

Choosing the right value:

  • Busy sites: As the description suggests, busy sites with frequent traffic and data updates benefit from a lower interval (e.g., 30 minutes or less) to prioritize fresh data and maximize disk space utilization.
  • Less busy sites: For sites with lower traffic and less frequent updates, a longer interval can be suitable to minimize the impact on server resources while maintaining reasonable data freshness.

Global groups

Default Value:

users
userlogins
usermeta
user_meta
site-transient
site-options
site-lookup
blog-lookup
blog-details
rss
global-posts

This setting controls what object groups should be cached in a multisite network. Caching these groups helps by reducing redundant database queries across all sites in the multisite network.

For example, the default value for this setting includes users, userlogins, usermeta, and user_meta. Caching user data can significantly improve login times and profile loading speeds across all sites in the Multisite network. Since user data is often changes infrequently, caching provides a performance boost without compromising data accuracy.

Non-persistent groups

Default Value:

counts
plugins

This setting defines a list of object prefixes that W3 Total Cache will exclude from object caching. Any object name that starts with one of the listed prefixes will not be cached.

Examples

  • Dynamically changing data: Objects that frequently (like counts or shopping cart contents) are not ideal for caching as they can quickly become outdated. Excluding them prevents serving stale data.
  • Plugin behavior: Some plugins might not function correctly if their data is cached. Excluding plugin-specific objects from caching ensures compatibility.

Enable caching for wp-admin requests

Default Value: Disabled

This setting controls whether object caching applies to requests made from the WordPress admin area. If enabled, certain frequently accessed data used within the admin dashboard and functionalities can be cached, potentially speeding up your admin experience.

Use this setting with caution, while frequently used elements in the admin interface, like user data, plugin options, or menu structures, could load quicker if cached, caching admin data raises major concerns about data freshness. Some plugins or themes might not be compatible with admin caching, potentially causing errors or unexpected behavior. For sensitive information such as user profile data this could pose some security concerns without additional measures to prevent unauthorized access or vulnerabilities.

Store transients in database

Default Value: Enabled

Transients are temporary data pieces stored in the database for short periods, usually used by plugins or WordPress itself to cache specific values.

If you use an external cache system (such as Redis or Memcached) alongside W3 Total Cache, the standard would be to store transients in that external cache alongside other object cache data. With this setting disabled, when you purge the object cache the cached transients in the external cache are also purged, even though they might still be valid. Enabling this setting prevents that issue by forcing all transients to be stored in the database so that they maintain their intended lifespan.

W3 Total Cache

You haven't seen fast until you've tried PRO

   Full Site CDN + Additional Caching Options
   Advanced Caching Statistics, Purge Logs and More

Everything you need to scale your WordPress Website and improve your PageSpeed.

Leave a Reply

Your email address will not be published. Required fields are marked *

W3 Total Cache logo

We Can Help Optimize Your Website

Optimize your site’s performance with our one-time premium services or ongoing monthly VIP support. View services

Partners

Bunny CDN Logo