SQLite Object Cache

WordPress persistent object caching for the rest of us.

persistent object cache helps your site perform well. This one uses the widely available SQLite3 extension to php. Many hosting services offer it. If your hosting service does not provide memcached or redis, you may be able to use this plugin instead and get the benefit of object caching.

Caches 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 cache.

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 gets everything it needs from your database server. Only then can it deliver content to your user. With a persistent object cache, WordPress has immediate access to much of the information it needs. This lightens the load on your database server and delivers content to your users faster.

In SQLite, the data is in a file-system file memory-mapped to the code using it. And, each web server process (running php for WordPress) maps the file the way it needs it. No client / server protocol. So this puts computational and I/O load on the web server process, rather than on a traditional RDBMS.

The WordPress object cache is a kind of memoization of function results. It caches the results of various WordPress functions. When the cache misses, those functions do all sorts of work — database lookups, computations — to regenerate the results. So it’s not a traditional query cache, but rather an application cache. Some cache hits can avoid several SQL operations, and others save none, because their contents came from some other source.

WordPress scales up well. It depends on a scaled-up persistent object cache subsystem (usually either redis, or memcached). These object caches are what allow WordPress web servers to be load-balanced at massive scale. WordPress.org (hosting all downloads and a very busy community) is one such operation. WordPress.com, their managed-hosting service, is famous for hosting people like Krebs on Security, who get very high traffic and are sometimes the targets of DDOS attacks. Other hosting providers also operate at scale.