{"id":165801,"date":"2022-12-06T22:46:32","date_gmt":"2022-12-06T22:46:32","guid":{"rendered":"https:\/\/wordpress.org\/plugins\/sqlite-object-cache\/"},"modified":"2026-03-23T09:58:18","modified_gmt":"2026-03-23T09:58:18","slug":"sqlite-object-cache","status":"publish","type":"plugin","link":"https:\/\/wordpress.org\/plugins\/sqlite-object-cache\/","author":9099428,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"1.6.3","stable_tag":"1.6.3","tested":"7.0","requires":"5.5","requires_php":"5.6","requires_plugins":null,"header_name":"SQLite Object Cache","header_author":"Oliver Jones","header_description":"A persistent object cache backend powered by SQLite3.","assets_banners_color":"5a5049","last_updated":"2026-03-23 09:58:18","external_support_url":"","external_repository_url":"https:\/\/github.com\/OllieJones\/sqlite-object-cache","donate_link":"https:\/\/github.com\/sponsors\/OllieJones","header_plugin_uri":"https:\/\/github.com\/OllieJones\/sqlite-object-cache","header_author_uri":"https:\/\/github.com\/OllieJones\/","rating":5,"author_block_rating":0,"active_installs":9000,"downloads":121560,"num_ratings":49,"support_threads":2,"support_threads_resolved":2,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":{"0.1.7":{"tag":"0.1.7","author":"OllieJones","date":"2022-12-06 22:46:16"},"1.0.0":{"tag":"1.0.0","author":"OllieJones","date":"2023-01-10 19:55:25"},"1.1.0":{"tag":"1.1.0","author":"OllieJones","date":"2023-01-20 14:07:02"},"1.1.1":{"tag":"1.1.1","author":"OllieJones","date":"2023-01-23 22:22:58"},"1.2.0":{"tag":"1.2.0","author":"OllieJones","date":"2023-02-03 20:53:47"},"1.2.1":{"tag":"1.2.1","author":"OllieJones","date":"2023-02-15 15:06:22"},"1.2.2":{"tag":"1.2.2","author":"OllieJones","date":"2023-02-22 14:23:42"},"1.2.3":{"tag":"1.2.3","author":"OllieJones","date":"2023-03-16 17:33:03"},"1.3.0":{"tag":"1.3.0","author":"OllieJones","date":"2023-04-27 11:12:48"},"1.3.1":{"tag":"1.3.1","author":"OllieJones","date":"2023-05-08 13:30:39"},"1.3.2":{"tag":"1.3.2","author":"OllieJones","date":"2023-05-30 15:42:01"},"1.3.4":{"tag":"1.3.4","author":"OllieJones","date":"2023-06-07 12:42:23"},"1.3.5":{"tag":"1.3.5","author":"OllieJones","date":"2023-10-25 13:39:26"},"1.3.6":{"tag":"1.3.6","author":"OllieJones","date":"2023-12-05 11:29:31"},"1.3.7":{"tag":"1.3.7","author":"OllieJones","date":"2023-12-11 15:34:33"},"1.3.8":{"tag":"1.3.8","author":"OllieJones","date":"2024-10-28 17:53:12"},"1.4.0":{"tag":"1.4.0","author":"OllieJones","date":"2025-01-27 15:41:09"},"1.4.1":{"tag":"1.4.1","author":"OllieJones","date":"2025-02-14 19:31:22"},"1.5.1":{"tag":"1.5.1","author":"OllieJones","date":"2025-02-25 14:22:30"},"1.5.4":{"tag":"1.5.4","author":"OllieJones","date":"2025-03-12 16:31:24"},"1.5.5":{"tag":"1.5.5","author":"OllieJones","date":"2025-04-09 20:51:31"},"1.5.6":{"tag":"1.5.6","author":"OllieJones","date":"2025-04-17 14:13:09"},"1.5.7":{"tag":"1.5.7","author":"OllieJones","date":"2025-10-05 22:24:29"},"1.6.0":{"tag":"1.6.0","author":"OllieJones","date":"2025-11-26 18:30:18"},"1.6.1":{"tag":"1.6.1","author":"OllieJones","date":"2026-01-26 18:26:56"},"1.6.2":{"tag":"1.6.2","author":"OllieJones","date":"2026-03-18 13:50:26"},"1.6.3":{"tag":"1.6.3","author":"OllieJones","date":"2026-03-23 09:58:18"}},"upgrade_notice":{"":"
Correct a race condition upon cache item expiration. Improve SQLite3 checkpointing to reduce the probability of huge WAL files. Add a health check for OPcache (not APCu) exhaustion.<\/p>"},"ratings":{"1":0,"2":0,"3":0,"4":0,"5":49},"assets_icons":{"icon-128x128.jpg":{"filename":"icon-128x128.jpg","revision":2829632,"resolution":"128x128","location":"assets","locale":""}},"assets_banners":{"banner-772x250.jpg":{"filename":"banner-772x250.jpg","revision":2829632,"resolution":"772x250","location":"assets","locale":""}},"assets_blueprints":{},"all_blocks":[],"tagged_versions":["0.1.7","1.0.0","1.1.0","1.1.1","1.2.0","1.2.1","1.2.2","1.2.3","1.3.0","1.3.1","1.3.2","1.3.4","1.3.5","1.3.6","1.3.7","1.3.8","1.4.0","1.4.1","1.5.1","1.5.4","1.5.5","1.5.6","1.5.7","1.6.0","1.6.1","1.6.2","1.6.3"],"block_files":[],"assets_screenshots":{"screenshot-1.png":{"filename":"screenshot-1.png","revision":3254906,"resolution":"1","location":"assets","locale":""},"screenshot-2.png":{"filename":"screenshot-2.png","revision":3246505,"resolution":"2","location":"assets","locale":""}},"screenshots":{"1":"Settings panel. Access it with Settings > Object Cache.","2":"Performance statistics panel."},"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[7915,146,7913,247,28201],"plugin_category":[52,54],"plugin_contributors":[86923],"plugin_business_model":[216239],"class_list":["post-165801","plugin","type-plugin","status-publish","hentry","plugin_tags-apcu","plugin_tags-cache","plugin_tags-object-cache","plugin_tags-performance","plugin_tags-sqlite","plugin_category-performance","plugin_category-security-and-spam-protection","plugin_contributors-olliejones","plugin_business_model-community","plugin_committers-olliejones"],"banners":{"banner":"https:\/\/ps.w.org\/sqlite-object-cache\/assets\/banner-772x250.jpg?rev=2829632","banner_2x":false,"banner_rtl":false,"banner_2x_rtl":false},"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/sqlite-object-cache\/assets\/icon-128x128.jpg?rev=2829632","icon_2x":false,"generated":false},"screenshots":[{"src":"https:\/\/ps.w.org\/sqlite-object-cache\/assets\/screenshot-1.png?rev=3254906","caption":"Settings panel. Access it with Settings > Object Cache."},{"src":"https:\/\/ps.w.org\/sqlite-object-cache\/assets\/screenshot-2.png?rev=3246505","caption":"Performance statistics panel."}],"raw_content":"\n
A persistent object cache<\/a> helps your site perform well. This one uses the widely available SQLite3<\/a> extension, and optionally the igbinary<\/a> and APCu<\/a> extensions to php. Many hosting services offer those extensions, and they are easy to install on a server you control.<\/p>\n\n It's about making your site's web server perform better. An object cache does that by reducing the workload on your MariaDB or MySQL database. This is not a page cache<\/a>; these persistent objects go into a different kind of cache. These objects aren't chunks of web pages ready for people to view in their browsers, they are data objects for use by the WordPress software.<\/p>\n\n Caches<\/a> are ubiquitous in computing, and WordPress has its own caching subsystem. Caches contain short-term copies of the results of expensive database lookups or computations, and allow software to use the copy rather than repeating the expensive operation. This plugin (like other object-caching plugins) extends WordPress's caching subsystem to save those short-term copies from page view to page view. WordPress's cache happens to be a memoization<\/a> cache.<\/p>\n\n Without a persistent object cache, every WordPress page view must use your MariaDB or MySQL database server to retrieve everything about your site. When a user requests a page, WordPress starts from scratch and loads everything it needs from your database server. Only then can it deliver content to your user. With a persistent object cache, WordPress immediately loads much of the information it needs. This lightens the load on your database server and delivers content to your users faster.<\/p>\n\n If your site runs on a single web server machine, and that server provides the SQLite3<\/a> and igbinary<\/a> extensions to php, this plugin will almost certainly make your site work faster. And if that server provides the APCu<\/a> extension, this plugin uses it too.<\/p>\n\n Some hosting providers offer redis<\/a> cache servers. If your provider offers redis, it may be a good choice. You can use it via the Redis Object Cache<\/a> plugin. Sites using redis have one SQL database and another non-SQL storage server: redis. Other hosting providers offer memcached<\/a>, which has the Memcached Object Cache<\/a> plugin. And some large multipurpose cache plugins, such as the LiteSpeed Cache<\/a>, also offer object caching based on one of those cache server software packages.<\/p>\n\n The cache-server approach to object caching comes into its own when you have multiple load-balanced web server machines handling your site. SQLite doesn't work correctly in a multiple-web-server environment.<\/p>\n\n But, for single-server site configurations, SQLite, possibly assisted by APCu, performs well. And the vast majority of sites are single-server.<\/p>\n\n APCu<\/a> is an in-memory storage medium. It lets php programs, like WordPress, store data in shared memory so it's very fast to retrieve when needed. If APCu is available on your host server, you can configure this plugin to use it. It reduces the typical cache lookup time to one-fifth or less of the SQLite lookup time, which is itself a few tens of microseconds. Performance counts, especially on busy web sites.<\/p>\n\n Please look at Installation<\/a> to learn how to configure this plugin to use APCu. The plugin works fast without it, and faster with it.<\/p>\n\n WP-CLI: Even if APCu is in use, caching with SQLite is necessary when your web site uses WP-CLI, because WP-CLI programs do not have access to the APCu cache. This plugin writes all cached data both to APCu and to SQLite and makes sure the two are synchronized.<\/p>\n\n You can control this plugin via WP-CLI once you activate it. Please type this command into your shell for details.<\/p>\n\n Thanks to Till Kr\u00fcss<\/a>. His Redis Object Cache<\/a> plugin serves as a model for this one. And thanks to Ari Stathopoulos<\/a> and Jonny Harris<\/a> for reviewing this. Props to Matt Jones for finding and fixing a bug that appeared on a heavily loaded system. Thanks to Massimo Villa<\/a> for testing help, and to nickchomey<\/a> for a comprehensive code review. All defects are, of course, entirely the author's responsibility.<\/p>\n\n And thanks to Jetbrains for the use of their software development tools, especially PhpStorm<\/a>. It's hard to imagine how a plugin like this one could be developed without PhpStorm's tools for exploring epic code bases like WordPress's.<\/p>\n\n We offer several plugins to help with your site's database efficiency. You can read about them here<\/a>.<\/p>\n\n\n For this plugin to work for you, your server must<\/em> have the SQLite3<\/a> extension to php installed.<\/p>\n\n If you have the igbinary<\/a> and APCu<\/a> extensions, this plugin uses them to work more efficiently. But it works without them.<\/p>\n\n Installing \"SQLite Object Cache\" can be done either by searching for \"SQLite Object Cache\" via the \"Plugins > Add New\" screen in your WordPress dashboard, or by using the following steps:<\/p>\n\n Or, use these WP-CLI commands to install the plugin, secure it, activate it, and set the cache size to 32MiB.<\/p>\n\n The plugin offers a few optional settings for your When multiple sites share the same server hardware and software, they can sometimes share the same cache data. Setting To set the value put a line like this in Of course, use your own random value, not the one in this example. You can get one from your Linux command line shell with the APCu<\/a> is an in-memory storage medium. If APCu is available on your host server, you can configure this plugin to use it. There is an option to enable it on the plugin's Settings page. Or you can do it manually. Put a WP_SQLITE_OBJECT_CACHE_APCU value of Or, you can edit your Yes<\/strong>. To see the Settings page, choose Settings > Object Cache from the first site, or any site, in the multisite installation.<\/p><\/dd>\n Exactly predicting each site's speedup is not possible. Still, benchmarking results comparing it to other object caching schemes are promising. Please see this<\/a>. If you run a benchmark, please let the author know by leaving a comment on that page or using the support forum<\/a>.<\/p><\/dd>\n The default setting for Cached Data Size is 16 megabytes (MiB). This plugin allows the actual cached data size to grow larger than that, and occasionally removes old -- the least recently updated -- data to trim back the size to the setting. Take a look at the Statistics page. If your actual cached data usage under All Groups is consistently larger than the setting, double the setting.<\/p>\n\n If you operate a large and busy site, try an initial setting of 32 MiB, then adjust it based on the growth of the actual size.<\/p>\n\n Notice that this setting controls the size of the data in the cache. That is the size shown under All Groups. The data file used by SQLite is larger than that.<\/p><\/dd>\n SQLite<\/a> is fast and efficient database software. It doesn't require a separate server. Instead, it is built into php using the SQLite3<\/a> extension. SQLite programs don't need to open network connections to send requests and wait for replies.<\/p><\/dd>\n igbinary<\/a> is a php extension that provides an efficient way to serialize and compress the kinds of data objects stored in caches. It, in some cases, uses less than half the storage space of the built-in php data serializer<\/a>. If igbinary is available in your php configuration, this plugin uses it, unless you force it not to by setting What is this about?<\/h4>\n\n
Who should use this?<\/h4>\n\n
APCu<\/h4>\n\n
WP-CLI<\/h4>\n\n
wp help sqlite-object-cache\n<\/code><\/pre>\n\nCredits<\/h4>\n\n
How can I learn more about making my WordPress site more efficient?<\/h4>\n\n
\n
wp plugin install sqlite-object-cache\nwp config set WP_CACHE_KEY_SALT $(openssl rand -base64 12)\nwp plugin activate sqlite-object-cache\nwp sqlite-object-cache size 32\n<\/code><\/pre>\n\nwp-config.php<\/code> file. Do not change them while the plugin is activated. If you change them, deactivate the plugin first, then change them, then reactivate the plugin.<\/p>\n\n\n
\u2026\/wp-content\/.ht.object_cache.sqlite<\/code>. Use this if you want to place the SQLite cache file outside your document root.<\/li>\nConfiguring the cache key salt<\/h4>\n\n
WP_CACHE_KEY_SALT<\/code> to a hard-to-guess random value for each site makes it much harder for one site to get another site's data. This works for other cache plugins too. Notice that this WP_CACHE_KEY_SALT<\/code> value must be set, in your site's wp-config.php<\/code> file, before activating any cache plugin, including page caches and persistent object caches.<\/p>\n\nwp-config.php<\/code>.<\/p>\n\ndefine( 'WP_CACHE_KEY_SALT', 'Random_t6xJix' );\n<\/code><\/pre>\n\nopenssl rand -base64 12<\/code>. Or, if you use WP-CLI you can set the value directly with<\/p>\n\nwp config set WP_CACHE_KEY_SALT $(openssl rand -base64 12)\n<\/code><\/pre>\n\nConfiguring and Using APCu<\/h4>\n\n
true<\/code> into your wp-config.php<\/code> file. You can use this WP-CLI command to do that.<\/p>\n\nwp config set --raw WP_SQLITE_OBJECT_CACHE_APCU true\n<\/code><\/pre>\n\nwp-config.php<\/code> file to add this line.<\/p>\n\ndefine( 'WP_SQLITE_OBJECT_CACHE_APCU', true );\n<\/code><\/pre>\n\n\n\n
Does this work with a multisite WordPress installation?<\/h3><\/dt>\n
How much faster will this make my site?<\/h3><\/dt>\n
What Cached Data Size should I use for my site?<\/h3><\/dt>\n
What is SQLite?<\/h3><\/dt>\n
What is igbinary?<\/h3><\/dt>\n
WP_SQLITE_OBJECT_CACHE_SERIALIZE<\/code> to true<\/code> in wp-config.php<\/code>.<\/p><\/dd>\nWhat is APCu?<\/h3><\/dt>\n