[wp-hackers] Object Cache API and Persistent Object Caching
ryan at boren.nu
Mon Nov 7 22:17:08 GMT 2005
This introduces a new object cache API. You can see the implementation
in the cache.php file.
The API is very similar to memcached. It's basically just a set/get
Since the entire implementation is pluggable, you could even use
memcache on the backend if you like. If a wp-content/object-cache.php
file is present, that file is loaded instead of wp-includes/cache.php.
The default implementation introduces a WP_Object_Cache class that
handles writing objects out to disk and loading them into memory upon
request. wp-content must be writable for this to work. If it is not
writable, we fall back to the old way of populating the cache with big
SELECT * calls on every page load. Currently, the persistent cache is
disabled by default. If you would like to help test, go into
wp-settings.php and comment out the DISABLE_CACHE line. I've attached a
dump_queries.php plugin that will dump query and cache stats into the
footer for debug/diagnostic purposes.
Categories, options, users, and pages are cached. My tests with Apache
Bench show a few percent performance increase on my testbeds. We need
some tests on busy shared hosts with lots of disk activity going on to
see how it handles.
Cache expiration, cache file deletion upon object delete, and some other
small items remain to be done. And I think we'll need finer grained
locking on the cache. Perhaps one lock for the global groups and one
for the per blog groups. Right now we have one big lock, which will be
problematic with WPMU most likely.
Take a look, kick the tires, and give feedback and patches. If anyone
wants to take a shot at a memcached version, I'll gladly help out. I'm
interested in comparing numbers between different implementations.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 956 bytes
Desc: not available
Url : http://comox.textdrive.com/pipermail/wp-hackers/attachments/20051107/0480fe2a/dump_queries-0003.bin
More information about the wp-hackers