Resolving Issues When LiteSpeed Cache's Object Cache File Persists After Disabling
Content
If you've disabled object caching in the LiteSpeed Cache plugin but are still encountering errors related to the object-cache.php file, you're not alone. This is a known behavior that can cause significant issues on a WordPress site. This guide explains why it happens and the steps you can take to resolve it.
Understanding the Problem
When you enable the Object Cache feature (for Redis or Memcached), the LiteSpeed Cache plugin creates a file named object-cache.php in your wp-content/ directory. This file is integral to how WordPress interfaces with the external object cache service.
The core issue, as reported by users, is that disabling the feature in the plugin's settings does not automatically remove this file. Because the file remains, WordPress continues to load it and attempt to connect to the now-disabled Redis or Memcached instance. This results in errors, most notably the failure to retrieve transients, which can break various site functionalities.
Why This Happens
Based on community reports and plugin behavior, the object-cache.php file is treated as a semi-permanent component. The plugin's design does not include an automatic cleanup routine for this file upon feature deactivation. This can be considered a gap between user expectation and the plugin's actual behavior.
How to Fix It: Manually Remove the File
The definitive solution is to manually delete the object-cache.php file. This action will force WordPress to fall back to its default database-based object caching, immediately resolving the connection errors.
- Access Your Server: Connect to your website's server using SFTP, FTP, or your hosting provider's file manager.
- Navigate to the Root Directory: Locate your WordPress installation's root directory (where
wp-config.phpis located). - Go to wp-content: Open the
wp-content/folder. - Find and Delete the File: Look for the
object-cache.phpfile. Right-click on it and select Delete or Remove.
Important: You should only perform this deletion after you have disabled the Object Cache feature within the LiteSpeed Cache plugin settings. Deleting the file while the feature is still active could cause undefined behavior.
Best Practices and Considerations
- Always Backup: Before making any changes to your site's files, ensure you have a recent backup.
- Plugin Deactivation: As noted in other community threads, the plugin does not perform a full cleanup of all cache files and data upon deactivation. This behavior is consistent for the
object-cache.phpfile. Manual intervention is often required. - Re-enabling Object Cache: If you decide to use object caching again in the future, the LiteSpeed Cache plugin will regenerate the
object-cache.phpfile automatically when you enable and save the settings.
By understanding this behavior and knowing how to manually clean up the file, you can prevent errors and ensure your site functions correctly after disabling object caching.
Related Support Threads Support
-
object-cache.php not removed when Object Caching is disabledhttps://wordpress.org/support/topic/object-cache-php-not-removed-when-object-caching-is-disabled-2/
-
Does Your Plugin Delete All Cache Upon Deactivation?https://wordpress.org/support/topic/does-your-plugin-delete-all-cache-upon-deactivation/
-
Delete cache expired Functionhttps://wordpress.org/support/topic/delete-cache-expired-function/
-
WooCommerce products showing without VAThttps://wordpress.org/support/topic/woocommerce-products-showing-without-vat/
-
WooCommerce purges cache too oftenhttps://wordpress.org/support/topic/woocommerce-purges-cache-too-often/
-
Object Cache and WooCommerce Product Visibility Settinghttps://wordpress.org/support/topic/object-cache-and-woocommerce-product-visibility-setting/
-
Content From An APIhttps://wordpress.org/support/topic/content-from-an-api/
-
Product cache is not clearedhttps://wordpress.org/support/topic/product-cache-is-not-cleared/
-
Litespeed cache automatic purge woocommercehttps://wordpress.org/support/topic/litespeed-cache-automatic-purge-woocommerce/
-
wp_cache_supports( ‘flush_group’ )https://wordpress.org/support/topic/wp_cache_supports-flush_group/
-
Regular Price after Sale Ended Woo – Not Updatinghttps://wordpress.org/support/topic/regular-price-after-sale-ended-woo-not-updating/
-
WooCommerce Stock Cachehttps://wordpress.org/support/topic/woocommerce-stock-cache-2/
-
No Purge on product updatehttps://wordpress.org/support/topic/no-purge-on-product-update/