Cache Money stores all database result sets on the filesystem as serialized data, by using the oft-neglectged wp-content/db.php to extend the normal $wpdb class. Result sets will be updated as needed on a user by user basis when they do actions that perform update queries.
Please note that this is not a full scale page cache, like WP-Cache or WP Super Cache, although this will work just fine in conjunction. Cache Money is meant for sites with constantly changing content, where a full cache may not be suitable.
Tested with WordPress and WordPress MU 2.8.0 ~ 3.1
Requires PHP 5, like all good PHP apps.
- Place entire /wpdb-cache-money/ directory to the /wp-content/plugins/ directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
This doesn’t do anything!
Yes it does. Hey, didn’t you ask this question over on my other plugin too?
I need the cache to be cleared at a different interval than 5 minutes.
$cacheMoney->threshold to whatever number of seconds you wish.
How can I tell if this is working?
The directory wp-content/plugins/wpdb-cache-money/ should be full of files with names similar to
4a13fc6a615ac14cc3f58160ce9c52f3.php. If not, check to make sure this directory is writable by your server.
echo $wpdb->stats(TRUE) will give you a result like
q: 9 | c: 6 | m: 9.055 t: 0.171.
q is the number of actual database queries,
c is the number of cached queries,
m is the memory usage in megabytes, and
t is the time in seconds to render the page.
echo $wpdb->stats() will do the same, wrapped in an html comment, for times when you need to be discrete. There is also a profiler method –
echo $wpdb->profiler(). You will need to make sure
$cacheMoney->useProfiler is set to
TRUE to use this. The default for the profiler is to sort the queries by length of time descending.
$wpdb->profiler(FALSE) will show the queries in the order performed.
Contributors & Developers
“WPDB Cache Money” is open source software. The following people have contributed to this plugin.
- Admin settings area added, major code cleanup, bumped min WP version to 3.0 *
- Minor code cleanup *
- Important security fix *
- Not caching options queries using autoload, was screwing up wp cron
- Added second parameter to wp->query(), to bypass reset of internal timer on inserts
- Using HEREDOC syntax for serialized data
- Improved caching with FOUND_ROWS() queries
- Fixed bug in escaped single quotes in serialized data.
- Allows a salt, used in the md5 generation of file names.
- Allows logged in administrators to clear all cache info with the variable ?cache-clear in query string
- Allows logged in administrators to view cache info with the variable ?cache-profile in query string, set to ‘sort’ to sort by length
- clearCache() method to empty cache files. Called automatically on plugin deactivation.
- Improved styles in profiler().
- First pass at query browser. This is not active – if this proves to be a bad idea, will be removed from later versions.
- Refined profiler() methods.
- Bug fixes. First pass at documentation, profiler() methods.
- Initial public release. No documentation.