inpsyde / WP-Stash

Bridge between WordPress and StashPHP, providing a PSR6-compliant caching system for WordPress
https://inpsyde.com/en/wordpress-caching-system-wpstash/
GNU General Public License v2.0
51 stars 12 forks source link

Provide a way to bypass object cache entirely #16

Closed dnaber-de closed 4 years ago

dnaber-de commented 4 years ago

On development environments it's sometimes necessary to disable a persistent object cache. I could simply use the «Ephemeral» driver but this still enables WordPress wp_use_external_object_cache() which in turn saves the transients to the object cache instead of database. But that means transients are lost after each PHP process and this makes WP admin notably slow.

My suggestion is to introduce an environment variable WP_STASH_BYPASS that would cause an early return in object-cache.php. As WordPress double checks the existence of wp_cache_init() in wp_start_object_cache() https://github.com/WordPress/WordPress/blob/master/wp-includes/load.php#L622-L626 this would cause WP to do not assume an external object cache.