[wp-hackers] overriding the built-in cache

Ryan Boren ryan at boren.nu
Thu Jan 5 04:02:52 GMT 2006

On Wed, 2006-01-04 at 22:45 -0500, Scott Merrill wrote:
> I then modified wp_cron_init() to call wp_cache_flush() if it is time to
> run a cron job.  That failed, and I still get the test email with every
> page view.
> Even uncommenting DISABLE_CACHE in wp-settings.php does not work: I
> still get an email with every page view, even though the current time is
> less than wp_cron_hourly_lastrun + 3600.
> I've skimmed wp-includes/cache.php, but I confess that I don't quite get
> how it works yet.
> How can a plugin bypass the cache on a programmatic basis?  Is it even
> possible?

With DISABLE_CACHE set, caching falls back to 1.5 behavior where all
options are pulled from the DB and stuck in memory.  The persistent
cache is not used.  So, this *should* be the same as 1.5.  You can dump
the output of $wp_object_cache->stats() somewhere and compare that
against what is in the DB.

I might add wp_cache_disable() and wp_cache_enable() for use by
importers which need to circumvent all in memory caching.  I wouldn't
suggest plugins disable the cache in such a manner. Instead we should
fix whatever is wrong.


More information about the wp-hackers mailing list