[wp-trac] [WordPress Trac] #22661: Allow object caches to degrade gracefully

WordPress Trac noreply at wordpress.org
Fri Jan 23 21:05:16 UTC 2015


#22661: Allow object caches to degrade gracefully
--------------------------+-----------------------------
 Reporter:  markjaquith   |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Future Release
Component:  Cache API     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  2nd-opinion   |     Focuses:
--------------------------+-----------------------------

Comment (by jipmoors):

 If you use an ''object-cache.php'' (or advanced-cache.php) without the
 ''wp_cache_init'' function then the wp_using_ext_object_cache would remain
 '''false''' and you can attach to the filters and have the core
 ''cache.php'' being loaded. Which in turn calls the apply_filters.

 So without any modifications in file loading you can move forward by just
 enabling the apply_filters in all the cache.php functions.


 The only note with this is that ''first_init'' would be called every time.
 Which is actually a good thing, because we need the WP_Object_Cache to be
 instantized to provide fallback functionality.


 I see some ways of combating this problem:
 1. (favorable) Check for a ''define'' or ''function'' to verify a filter
 implementation is present
 2. Using a new file to check against for cache implementation via filters


 Adding to that the notion of writing unit-tests on the public functions of
 the Cache API instead of the class would make even more sense.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/22661#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list