You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PhpFastCache version: 7.0.2 (but the code appears the same in 7.0.5)
PhpFastCache API version: 2.0.4
PHP version: 7.2.14
Operating system: (MAMP Pro 5.3 on MacOS 10.13)
The APC driver's "driverClear" method, which should clear the entire cache, has been failing me. I make changes, clear the cache, and earlier cached data persists. So I started digging for answers.
I found driverClear in /Drivers/APC/Driver.php, which executes:
And should return "true." After a bunch of debugging statements and trials, I discovered that reducing the function to
apc_clear_cache('user')
worked fine, and cleared my cache! It turns out that, despitethe official PHP documentation, apc_clear_cache() returns NULL. Consequently, the 'user' version never gets executed, and that's what actually clears the cache.
My current configuration is using the "APC" driver, though APCu appears to also be installed under MAMP (see attached screenshot). I'm not sure what effect that may have on this behavior, but as-is, there seems to be a bug in the APC-only version. I have had to hack the Driver.php file in order to allow my cache-clearing mechanism to work properly.
Strangely, apc_clear_cache('user') properly returns a boolean rather than NULL, so simply omitting the parameter-less version (or even inverting the order) would at least execute the clearing before choking on the NULL.
The text was updated successfully, but these errors were encountered:
I do not claim to have a full understanding of every permutation of use, but for my standard LAMP stack usage with APC(u), driverClear() always fails in its current form, so something has to change.
I believe
{
@apc_clear_cache(); // returns null;
return @apc_clear_cache(‘user’); // returns true;
}
would solve the problem, allowing both calls to execute, but returning only the “true” returned by apc_clear_cache(‘user’).
Cheers,
spud.
Configuration
The APC driver's "driverClear" method, which should clear the entire cache, has been failing me. I make changes, clear the cache, and earlier cached data persists. So I started digging for answers.
I found driverClear in /Drivers/APC/Driver.php, which executes:
return @apc_clear_cache() && @apc_clear_cache('user');
And should return "true." After a bunch of debugging statements and trials, I discovered that reducing the function to
apc_clear_cache('user')
worked fine, and cleared my cache! It turns out that, despite the official PHP documentation, apc_clear_cache() returns NULL. Consequently, the 'user' version never gets executed, and that's what actually clears the cache.
My current configuration is using the "APC" driver, though APCu appears to also be installed under MAMP (see attached screenshot). I'm not sure what effect that may have on this behavior, but as-is, there seems to be a bug in the APC-only version. I have had to hack the Driver.php file in order to allow my cache-clearing mechanism to work properly.
Strangely, apc_clear_cache('user') properly returns a boolean rather than NULL, so simply omitting the parameter-less version (or even inverting the order) would at least execute the clearing before choking on the NULL.
The text was updated successfully, but these errors were encountered: