[wp-hackers] Caching in core? (was: Caching in 2.5: anyone has a file-based caching plugin? )

Knut-Olav Hoven hovenko at linpro.no
Sun Mar 23 11:09:02 GMT 2008

On Sunday 23 March 2008 11:29:24 Thomas Bukowski wrote:
> On Mar 23, 2008, at 2:30 AM, Mahmoud Al-Qudsi wrote:
> > He says he'll be releasing it soon. If I don't hear back from him,
> > I'll take it on as another caching project to add to the family, if
> > y'all like.
> I was thinking of submitting a gsoc proposal on something cache-
> related. Paint me ambitious, but I think there can be a cache solution
> that is acceptable for core inclusion. Obviously database-backed
> caching is the only kind that will be support on *all* deployments of
> WP.
> It wouldn't be too difficult to write an db-object-cache.php that
> would serialize objects and put them into the database. Another way to
> do it is to store snippets of HTML, from comments, posts and the like.
> Actually - caching can (should?) be integrated into the core, as
> suggested by the "Integrated Caching Solutions" gsoc idea. Right now,
> it consists of dumping files here and there. Instead, WP could ship
> with 1) an admin interface (under "Settings") to enable/disable
> caching, select caching type (db, memcached, etc) and configure these
> caches; 2) a default caching mechanism - most likely, a db-backed one.

I agree that caching should be integrated into the core, and storing it in a 
db-backend is fine by me.

Whenever I see heavy load on a PHP application it's allways the database that 
is taking the highest load, with bad written SQL statements with X amount of 
joins and sorting and function calls like "rand()".

Simple select on an indexed field (key) is very fast and would be a good 
solution for storing cache. Just keep in mind not to use function calls (as 
mentioned above), because MySQL does not cache any statements having function 

It's also easy to implement TTL too where the TTL is a date in the near future 
(like two hours) and issue the SQL statement like this.

DELETE FROM wp_cache WHERE ttl < NOW()

But, of course, not use NOW() but make PHP insert the date into the SQL 
statement in "YYYY-MM-DD HH:SS" format (or something) that MySQL supports, to 
releave MySQL server for unnessecary function calls... as MySQL doesn't have 
enough to do already...? ;)

The ttl column in wp_cache needs to be indexed too.

> Caching, I think, is a fairly crucial component of WP. A default
> caching method would raise the traffic a vanilla WP blog can take. I
> suppose there could also be a more official structure for all the
> plugins out there to plug into (pun not intended) - not just the the
> object cache as is now, but also an admin interface.
> Is this worth pursuing?
> Sorry for hijacking the thread; I hope Stephane/everyone doesn't mind!
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers

Knut-Olav Hoven
Systemutvikler               mob: +47 986 71 700
Linpro AS                    http://www.linpro.no/

More information about the wp-hackers mailing list