Frequently Asked Questions
- Does this work with a multisite WordPress installation?
- How much faster will this make my site?
- What is SQLite?
- Does this plugin replace MariaDB or MySQL with SQLite?
- Wait, what? Do I really need two different kinds of SQL database?
- Is this plugin compatible with my version of MySQL or MariaDB?
- Is this plugin compatible with my version of redis or memcached?
- Why not use the site’s main MariaDB or MySql database server for the object cache?
- Do I have to back up the data in SQLite?
- If I already have another persistent object cache, can I use this one?
- If I operate a scaled-up load-balanced installation, can I use this?
- Can I use this with the Performance Lab plugin?
- How does this work?
- Where does the plugin store the cached data?
- Is there a joke somewhere in this?
- I have another question
Does this work with a multisite WordPress installation?
Yes. To see the Settings page, choose Settings > Object Cache from the first site, or any site, in the multisite installation.
How much faster will this make my site?
Exactly predicting each site’s speedup is not possible. You can measure cache performance on your own site, and see details. Benchmarking work looks promising, and is ongoing. Please see the results here.
What is SQLite?
SQLite is fast and efficient database software. It doesn’t require a separate server. Instead, it is built into php using the SQLite3 extension. SQLite programs don’t need to open network connections to send requests and wait for replies.
Does this plugin replace MariaDB or MySQL with SQLite?
No. Your MariaDB or MySQL database sql server still holds all your content. All your site’s imports, exports, backups and other database operations continue to function normally. This plugin uses SQLite simply to hold named values. For example, a value named “post|3” will hold a temporary, easy-to-retrieve cached copy of post number 3. When it needs that post, WordPress can fetch it quickly from SQLite.
Wait, what? Do I really need two different kinds of SQL database?
No, you don’t. This plugin doesn’t use SQLite as a full-fledged database server.
SQLite serves this plugin as a very simple key / value storage mechanism. A persistent object cache needs some kind of storage mechanism.
Some hosting providers offer scalable high-performance redis cache servers. If your provider offers redis, it is a good choice. You can use it via Redis Object Cache plugin. Sites using redis have one SQL database and another non-SQL storage scheme: redis. Other hosting providers offer memcached, which has the Memcached Object Cache.
But many hosting providers don’t offer either redis or memcached, while they do offer SQLite. This plugin enables your site to use a persistent object cache even without a separate cache server.
Is this plugin compatible with my version of MySQL or MariaDB?
Yes. It does not require any specific database server version.
Is this plugin compatible with my version of redis or memcached?
Why not use the site’s main MariaDB or MySql database server for the object cache?
In WordPress, as in many web frameworks, your database server is a performance bottleneck. Using some other mechanism for the object cache avoids adding to your database workload. Web servers serve pages using multiple php processes, and each process handles its own SQLite workload while updating a shared database file. That spreads the object-cache workload out over many processes rather than centralizing it.
Do I have to back up the data in SQLite?
No. It’s a cache, and everything in it is ephemeral. When WordPress cannot find what it needs in the cache, it simply recomputes it or refetches it from the database.
If I already have another persistent object cache, can I use this one?
No. You only need one persistent object cache, and WordPress only supports one.
If I operate a scaled-up load-balanced installation, can I use this?
No. If you have more than one web server this doesn’t work correctly. If you operate at that scale, use redis or some other cache server. (If you aren’t sure whether you have a load-balanced installation, you almost certainly do not.)
Can I use this with the Performance Lab plugin?
Yes, but you must activate this plugin first before you activate Performance Lab. And, you must deactivate Performance Lab before deactivating this plugin last.
The Performance Lab plugin offers some advanced and experimental ways of making your site faster. One of its features uses object-cache initialization code to start tracking performance. So there’s a required order of activation if you want both to work.
How does this work?
This plugin uses a WordPress drop-in to extend the functionality of the WP_Cache class. When you activate the plugin it creates the dropin file
.../wp-content/object-cache.php. Upon deactivation, it removes that file and the cached data.
Where does the plugin store the cached data?
It’s in your site’s
wp_content directory, in the file named
.ht.object-cache.sqlite. That file’s name has the
.ht. prefix to prevent your web server from allowing it to be downloaded. SQLite also sometimes uses the files named
.ht.object-cache.sqlite-wal, so you may see any of those files.
(On Linux and other UNIX-derived operating systems, you must give the command
ls -a to see files when their names begin with a dot.)
If you define the constant
wp_config.php the plugin uses that for the file name instead. For example, if
wp_config.php contains this line
define( 'WP_SQLITE_OBJECT_CACHE_DB_FILE', '/var/tmp/mysite-object-cache.sqlite' );
your object cache data goes into the
Is there a joke somewhere in this?
Q: What are the two hardest things to get right in computer science?
- Caching things.
- Naming things.
- Coping with off-by-one errors.
Seriously, the core of WordPress has already worked out, over years of development and millions of sites, how to cache things and name them. This plugin simply extends that mechanism to make those things persistent.
I have another question
Please ask it in a comment on this page, or on the plugin’s support forum.