The
{eac}Doojigger Object Cache ({eac}ObjectCache) is a light-weight and very efficient drop-in persistent object cache that uses a fast SQLite database to cache WordPress objects.
See
The WordPress Object Cache
The WordPress Object Cache is used to save on trips to the database. The Object Cache stores all of the cache data to memory and makes the cache contents available by using a key, which is used to name and later retrieve the cache contents.
By default, the object cache is non-persistent. This means that data stored in the cache resides in memory only and only for the duration of the request. Cached data will not be stored persistently across page loads unless you install a persistent caching plugin.
Here, an object is any piece of data - a number, text, a set of database records, an API response, etc. - that can be referenced by a name or key. Objects are categorized by a group name. Groups help identify what an object is and how it is used.
{eac}ObjectCache replaces the default WordPress object cache to not only store data in memory but to also store data persistently, across requests, in a SQLite database, increasing the likelihood of cache hits and decreasing the need for costly computations, complex MySQL database queries, and remote API requests.
SQLite is a fast, small, single-file relational database engine. By using SQLite to store objects, {eac}ObjectCache is able to manage a relatively large amount of data (groups, keys, and values) in a very efficient and fast data-store.
Features
- Lightweight, efficient, and fast!
- L1 (memory) and L2 (SQLite) caching.
- Supports Write-Back (delayed transactions) or Write-Through caching.
- Cache by object group name.
- Preserves uniqueness of keys.
- Manage keys by group name.
- Pre-fetch object groups from L2 to L1 cache.
- Caches and pre-fetches L2 misses (known to not be in L2 cache).
- Prevents repeated, unnecessary L2 cache reads across requests.
- Multisite / Network support:
- Cache by blog id.
- Flush by blog id.
- Caching statistics:
- Overall and L1/L2 hits, misses, & ratio.
- L1 hits by object groups.
- L2 group keys stored.
- L2 select/update/delete/commit counts.
- Supports a superset of WP_Object_Cache functions.
- Imports existing transients when enabled.
- Easily enabled or disabled from administrator page.
- Uses the PHP Data Objects (PDO) extension included with PHP.
{eac}ObjectCache is an extension plugin to and requires installation and registration of
{eac}Doojigger.
Automatic Plugin Installation
This plugin is available from the
WordPress Plugin Repository and can be installed from the WordPress Dashboard »
Plugins »
Add New page. Search for 'EarthAsylum', click the plugin's [Install] button and, once installed, click [Activate].
See
Managing Plugins -> Automatic Plugin Installation
Upload via WordPress Dashboard
Installation of this plugin can be managed from the WordPress Dashboard »
Plugins »
Add New page. Click the [Upload Plugin] button, then select the eacobjectcache.zip file from your computer.
See
Managing Plugins -> Upload via WordPress Admin
Manual Plugin Installation
You can install the plugin manually by extracting the eacobjectcache.zip file and uploading the 'eacobjectcache' folder to the 'wp-content/plugins' folder on your WordPress server.
See
Managing Plugins -> Manual Plugin Installation
Settings
Once installed and activated options for this extension will show in the 'Object Cache' tab of {eac}Doojigger settings.
Version 1.0.4 - May 24, 2024
- Fix for updated {eac}Doojigger Advanced Mode, remove from 'Tools' tab.
Version 1.0.3 - April 3, 2024
- Added notice if eacDoojigger is not active.
- Delete sqlite file(s) rather than records on flush.
- Set wp_installing and fixed expiration when importing transients,
- switch_to_blog() now flushes L1 and reloads prefetch groups.
- flush_blog() use
$this->blog_id
instead of get_current_blog_id()
.
- Suppress flush message when 0 records flushed.
- Use
options_form.requestSubmit()
instead of options_form.submit()
.
Version 1.0.2 - February 17, 2024
- Minor updates as per WordPress review team.
- Changed EAC_OBJECT_CACHE to EAC_OBJECT_CACHE_VERSION.
- Added ABSPATH check in wp-cache.php.
- Escape output of calculated cache ratio.
Version 1.0.1 - January 24, 2024
- Improved sanitization and output escaping.
- Changed constant EACDOOJIGGER_OBJECT_CACHE to EAC_OBJECT_CACHE.
Version 1.0.0 - December 9, 2023
- First public release, submitted to WordPress review team.
Version 0.5
- Testing in live, multisite environment.
- Ignore 'force_cache' flag (force L2 read).
- if we've updated a key, but not written yet, then force a persistent load, we lose that value.
- Added wp_flush_blog() function.
- Cache L2 misses saving sqlite selects on records known to not exist.
- Don't attempt read or delete on non-persistent groups.
- Added cache hit ratio to stats.
- Remove function call counts (for testing).
Version 0.4
- Enhanced admin screen with advanced options.
- Group constants used:
- EAC_OBJECT_CACHE_GLOBAL_GROUPS
- EAC_OBJECT_CACHE_NON_PERSISTENT_GROUPS
- EAC_OBJECT_CACHE_PERMANENT_GROUPS
- EAC_OBJECT_CACHE_PREFETCH_GROUPS
- Added non-standard wp_cache_add_permanent_groups(), wp_cache_add_prefetch_groups()
Version 0.3
- Parameterize timeout, retries.
- Import transients from MySQL.
- Rework select/replace/delete SQL.
- New select_one(), select_all() methods.
- key_exists(), key_exists_memory(), key_exists_database() replace _exists().
- Add permanent groups (allow no expiration, overriding default expire).
- Add function call counts (for testing).
Version 0.2
- Support add/get/set/delete _multiple methods (non-standard replace_multiple).
- Add pre-fetch groups.
- Add delayed writes.
- Add settings via defined constants.
- Add more detailed counts/stats.
- Manage install/uninstall, activate/deactivate actions.
Version 0.1
- Simple memory caching with get/set persistent cache supporting wp-cache functions.
- Testing SQLite methods.