I am working with Laravel and I created a route:call command the same way as the accepted answer in the following question: Call laravel controller via command line
Now I have a controller like follows:
class FooController
{
public function apcuClear(Request $request) : void
{
apcu_clear_cache();
echo "cleared";
}
}
With appropriate route setting, I can call through the route:call command using php artisan route:call --uri=/foo/apcuClear and the output "cleared" is correctly shown.
However the problem is that apcu cache is not cleared property and every requests to Laravel still ended up showing cached values.
The function apcu_clear_cache() itself is confirmed to be working correctly when it is called through an actual HTTP request and not through command line.
My guess is that, since the user "apache" is running Laravel when requests are made, which is different from the user running the route:call command on command line, apcu_clear_cache did not clear the correct cache.
Is my guess correct? And if so, how can I properly clear the apcu in the actual application using command line?