[wp-hackers] Useful caching

Roland Haeder webmaster at mxchange.org
Wed Sep 27 21:34:56 GMT 2006


Hello,

my patch is done now. You need latest SVN sourcecode so please update your SVN 
before applying it. First of all here is a list of what I have changed and 
why:

- Direct accesses on class fields replaced with getter/setter methods. This is 
about better security - currently only in Java but in PHP6, too! - and a 
better "design of code". There is a good guideline on Sun's webpage which you 
shall read and follow when you code object-orientated.

- Fetching RSS feeds on the dashboard can now sitched off by a constant. Put 
this one line to your wp-config.php:

define('DISABLE_RSS_FETCH', true);

You may need this if you want to use WP behind proxies installed on your 
company's workstation (*always* ask for permission! This can be a reason for 
getting fired). I will start another topic about this after I have finished 
this.

- Closing the database connection is implemented by a shutdown-function in 
wp-settings.php. This is always a good idea... ;-)

- SQL query cacher in alpha state added. This is my youngest baby and it shall 
reduce the number of queries on your database and increase the speed of your 
blog. Remember every request must be *send* to the database. Even when it is 
over a uni* socket (on Linux boxes the most case) its still slower than 
loading a "local" file. PHP needs to send the request over it's library to 
the SQL process, the SQL process loads some database files and processes 
them. Then the result got sent back to the PHP library.

Okay, you told me that your SQL queries are already optimized but 19 (!) 
SELECTs are still 19 queries and way too much for high-usage blogs.

Does someone know what kind of SQL statement (SELECT, UPDATE, INSERT or 
DELETE) is the most used? My opinion on this is SELECT.

Surely this cacher needs some improvement, including the compression methods. 
The functions gzcompress() and base64_encode() which are being used in my 
cacher are currently slowing down the blog too much. So let's have a look for 
faster PHP fucntions.

The cacher also has a built-in debugging function which displays some arrays. 
You can enable it with this:

define('DEBUG_SQL_CACHE', true);

The cacher itself can be enabled with this:

define('ENABLE_SQL_CACHE', true);

I have already added a new ticket you may want to read it here: (same text)
http://trac.wordpress.org/ticket/3174

All your comments on this work are welcome. :-)

Roland

And sorry for my poor english. :-)


More information about the wp-hackers mailing list