APC Object Cache Backend
[resolved] False negatives due to equality check instead of identicality che (2 posts)

  1. This is reproducable with a clean install of WordPress as it affects a core function.

    The is_multi_author() function stores its result in the cache as 0 or 1.

    In APC Object Cache's get() function we see this line:

    if ( 'checkthedatabaseplease' == $value )
    	$value = false;

    Due to implicit type comparison in PHP, 'checkthedatabaseplease' == 0 evaluates to true, which sets the return value to false, which gives is_multi_author() a false negative on the cache hit and therefore forces it to hit the database every time, when it doesn't need to.

    This means we get an unecessary database hit on every single page load because is_multi_author() is used in body_class().

    Easy fix. APC Object Cache just needs to check for identicality instead of equality:

    if ( 'checkthedatabaseplease' === $value )
    	$value = false;


  2. Mark Jaquith
    WordPress Lead Dev
    Plugin Author

    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • APC Object Cache Backend
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic