persistent object cache

Persistent Object Cache.

A persistent object cache is one of those recommendations your CMS might display as a recommendation, especially if you’re aiming to boost performance. But what exactly does using a persistent object cache involve and why would you want to use one? In this article, I’ll explain what object caching is, why it’s useful, explore the different types of object caching, and show you how to enable persistent object caching in platforms like WordPress and Joomla.

What is caching?

Caching is a technique used to store copies of frequently accessed data in a temporary storage location, so it can be retrieved quickly without needing to regenerate it each time.

Instead of loading content from the website’s database or reprocessing complex operations, a cache serves up a saved version (which save processing time and server resources). In the context of websites, caching helps reduce load times and improve performance by keeping commonly used data readily available.

What is an object cache?

An object cache stores the results of database queries or expensive operations in memory, so they can be reused without having to run the same query or process repeatedly.

In platforms like WordPress or Joomla, this often means caching things like menu structures, plugin settings, or content queries. By keeping these “objects” in memory, an object cache reduces the load on the database and speeds up page generation, especially on dynamic sites with a lot of content or logged-in users.

What are the advantages of object caching?

Object caching offers several performance benefits for dynamic websites.

By storing frequently used data in memory, it significantly reduces the number of database queries needed to generate each page. This leads to faster load times, lower server resource usage, and improved scalability, which is especially important for high-traffic sites or those with complex plugins and themes.

Object caching also helps keep things running smoothly for logged-in users, where full-page caching may not be possible.

Different object caching methods

There are several methods used to implement object caching, each with different performance characteristics and system requirements. The most common options are Redis, Memcached, database-based caching, and file system caching. While they all serve the same purpose (temporarily storing frequently accessed data to avoid repetitive database queries) they differ in how and where the data is stored, how quickly it can be accessed, and how scalable the solution is. Let’s take a closer look at each method.

Redis

Redis is a powerful in-memory data store often used for object caching because of its speed and flexibility. It stores key-value pairs in memory and supports data persistence, meaning it can save cached data to disk and reload it if the server restarts. Redis is ideal for high-traffic websites and applications that require complex caching strategies.

  • Advantages of Redis: Fast, persistent, supports advanced data types, and widely supported by CMS platforms like WordPress.
  • Disadvantages of Redis: Slightly more complex to configure than Memcached, and uses more memory due to its additional features.

Memcached

Memcached is another high-speed in-memory caching solution, optimised for simplicity and performance. It’s great for storing small, frequently accessed pieces of data. Unlike Redis, it does not support persistence or advanced data structures, it simply stores data in RAM until the cache is cleared or the server restarts.

  • Advantages of Memcached: Extremely fast, lightweight, and easy to set up.
  • Disadvantages of Memcached: No persistence, limited features compared to Redis, and can’t handle complex data types.

Database

Some content management systems use the database itself to store cached objects. This is typically a fallback method used when no memory-based cache (like Redis or Memcached) is available. While it can still reduce the need for repeated processing, it doesn’t offer much performance gain because the database is still being queried.

  • Advantages of database object caching: Easy to implement, no additional services needed.
  • Disadvantages of database object caching: Slower than memory-based caching, adds additional load to the database, and may not scale well under traffic spikes.

File system

File-based object caching stores cached objects as individual files on the server’s disk. It’s another fallback approach used when in-memory caching isn’t available. While it’s faster than making a full database query, file system access is still much slower than memory access.

  • Advantages of file system object caching: Works on almost any server setup, no extra software required.
  • Disadvantages of file system object caching: Slower than Redis or Memcached, can become inefficient with large numbers of cached files, and may cause disk I/O bottlenecks. Large numbers of cached files can also cause inode limits to be reached, which are usually enforced on shared hosting platforms.

Object caching offered by netnerd.com

All web hosting services provided by netnerd.com include both Redis and Memcached by default. Even our cheapest web hosting packages provide these. The settings you’d use to implement object caching with netnerd.com are:

Redis object cache settings:

Redis server address: localhost
Port: 6379

Memcached object cache settings:

Memcached server address: localhost
Port: 11211

Should you use Redis or Memcached for object caching?

Both Redis and Memcached are excellent choices for object caching, and the best option often depends on your site’s specific needs and hosting environment.

Redis is generally the preferred choice for modern WordPress and Joomla setups because it supports data persistence, advanced data types, and has better integration with many caching plugins. It’s ideal for dynamic, high-traffic sites where reliability and flexibility matter.

Memcached, on the other hand, is lightweight and extremely fast for simple key-value caching, making it a solid option for smaller sites or environments with limited memory.

If your host supports Redis, it’s usually the better long-term choice, but either will deliver a noticeable performance improvement over database or file-based caching.

Feature / Criteria

Redis

Memcached

Speed

Very fast

Extremely fast

Data Storage

In-memory with optional persistence

In-memory only (no persistence)

Data Types

Supports complex types (hashes, lists)

Simple key-value pairs only

Persistence

Yes (RDB & AOF options)

No

Scalability

High (more advanced clustering options)

High (basic multi-instance setups)

Memory Efficiency

Slightly higher overhead

Very efficient

Best For

Complex, high-traffic websites

Lightweight, small-to-medium sites

CMS/Plugin Support

Widely supported (e.g. WP Rocket, W3TC)

Also supported, but less feature-rich

Ease of Setup

Slightly more complex

Simple to install and configure

Authentication

Built-in

Requires external methods

Object Caching Recommendation:

If you’re hosting a busy or dynamic site and your server supports it, Redis is usually the better choice due to its advanced capabilities and broader plugin support. For simpler use cases or limited environments, Memcached offers excellent performance with minimal setup.

Configuring object caching in Joomla

Joomla has built in support for object caching, which can be configured directly from the Global Configuration panel. To enable it, go to System > Global Configuration:

joomla object caching

Then click the System tab:

joomla configure object caching

Under the Cache Settings section, choose a Cache Handler:

joomla enable object caching

Options typically include File, Redis, or Memcached, depending on your server setup. You can also set the Cache Time (in minutes) and choose the Platform Specific Caching level.

For Redis or Memcached, you’ll need to ensure the appropriate PHP extensions are installed and your caching service is running. Once configured, Joomla will begin storing frequently used data objects in the selected cache backend, improving performance and reducing database load.

Configuring object caching in WordPress

WordPress doesn’t enable persistent object caching by default, but you can easily add it with the help of caching plugins and external services like Redis or Memcached.

To configure object caching, you first need to have an object caching service installed and running on your server (for example, Redis or Memcached), and the respective PHP modules installed.

Then, within WordPress, you’d install a plugin such as Redis Object Cache, W3 Total Cache, Litespeed Cache that supports object caching. After activating the plugin, you’ll usually need to enable object caching from the plugin’s settings page and provide connection details if necessary.

Once configured, WordPress will store frequently accessed data objects in memory, dramatically improving site speed and reducing database load—especially for dynamic sites with logged-in users.

Redis Object Cache

redis object cache wordpress plugin

After installing and activating the Redis Object cache plugin for WordPress, you’ll then be directed to the settings page for this plugin. On this page there’s a button labelled “Enable Object Cache”. Click this button to enable object caching.

redis object cache plugin settings for wordpress

Object caching is now enabled for your WordPress. Because this plugin is a standalone object caching plugin you can use it along side caching plugins that provide page caching, minifying and combining, but not object caching to provide a full spectrum of caching.

Litespeed Cache

The Litespeed cache plugin provides object caching facilities, plus a lot of other caching and optimisation options.

Litespeed cache plugin for wordpress

After installing and activating Litespeed cache, object caching can be enabled by clicking on:
Litespeed cache > Cache > Object (tab)


You’d then configure your preferred object caching method, then save changes:

litespeed cache enable object cache wordpress

W3 Total Cache

The W3 total cache cache plugin provides object caching facilities, plus a lot of other caching and optimisation options.

w3 total cache plugin for wordpress

The W3 total cache cache plugin provides object caching facilities, plus a lot of other caching and optimisation options.

After installing and activating W3 total cache, object caching can be enabled by clicking on:
Performance > General Settings > Scroll down to the object cache section:

w3 total cache plugin object cache settings

After ticking “Enable” and selecting your preferred object caching method, click “save changes”.

FAQ: Persistent Object Caching

Q: What is caching?

A: Caching temporarily stores frequently accessed data to reduce load times and server processing, improving website performance.

Q: What is an object cache?

A: An object cache stores the results of database queries or expensive operations in memory so they can be quickly reused without repeated processing.

Q: What are the advantages of object caching?

A: Object caching reduces database load, speeds up page generation, improves scalability, and helps maintain smooth performance for logged-in users.

Q: What are the different methods of object caching?

A: The main methods are Redis, Memcached, database-based caching, and file system caching, each varying in speed, complexity, and persistence.

Q: Should I use Redis or Memcached?

A: Redis is generally better for complex, high-traffic sites due to persistence and advanced features. Memcached is lightweight and fast, suitable for simpler environments.

Q: How do I configure object caching in Joomla?

A: In Joomla’s Global Configuration under the System tab, enable caching by selecting a Cache Handler like Redis or Memcached and adjust cache time and other settings accordingly.

Q: How do I configure object caching in WordPress?

A: Install and activate a plugin such as Redis Object Cache or W3 Total Cache, then enable object caching in the plugin settings after ensuring the caching backend is running on your server.

Similar Posts

Leave a Reply