Support » Plugin: iThemes Security (formerly Better WP Security) » This plugin resets your entire APCu cache!

  • I was having a strange issue where my APCu cache from another site (not wp) was getting reset at apparently random times.
    After some debugging I traced the issue to this plugin that calls: “apc_clear_cache()” on two separate occasions. So, everytime somebody would load a page on our wordpress dashboard, the APCu cache was emptied.

    On the old APC, this command would delete just the opcode cache and not the user cache ( we would have to call apc_clear_cache(‘user’) to delete the user cache.

    But now that APC is being largely deprecated in favour of php5.5+ Zend opcode cache, a separate project called APCu (just the user cache part of APC) was created. With APCu, apc_clear_cache() resets the entire cache, including the user cache.

    I would recommend this plugins developers to detect if the user is using APC or APCu and only call apc_clear_cache() when it’s not APCu as this will reset the entire cache.

    Thanks.

    https://wordpress.org/plugins/better-wp-security/

Viewing 2 replies - 1 through 2 (of 2 total)
  • @itdev

    Thank you for this valuable feedback.

    I would recommend this plugins developers to detect if the user is using APC or APCu and only call apc_clear_cache() when it’s not APCu as this will reset the entire cache.

    How would this look like codewise ? Can you provide us with a code example ?

    dwinden

    Sure, on your plugins’ codebase there’s 2 instances where you call something like:

    if ( function_exists( 'apc_store' ) ) {
        apc_clear_cache(); //Let's clear APC (if it exists) when big stuff is saved.
    }

    You should probably change that to:

    if ( function_exists('apc_store') && !extension_loaded('apcu')) {
        apc_clear_cache(); //Let's clear APC (if it exists) when big stuff is saved.
    }

    That’s just of the top of my head without any testing, but I guess it should be enough.

    Best Regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘This plugin resets your entire APCu cache!’ is closed to new replies.