We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

How to "Flush ALL APCu cache"?

Hello, maybe I'm missing something, but... https://docs.phalcon.io/en/latest/reference/cache.html#apc-backend-options

I can't find a soultion how to clear all APCu cache, I'm trying to write a CLI scipt that will clear all APCu cache

        $apc = $this->di->get('apc'); // get APC via DI
        $apc->flush(); // as seen in Phalcon\Cache\Backend\Apc
edited Jul '16

Did you have apc extension added to cli? Phalcon is using APC classes, not apcu unfortunately.

APCu in php 5.x emulates only apc_* methods, not sure about classes.

yes, I have, but still nothing

I mean APC extension, not APCu, APCu on php 5.x is only emulating apc_* methods, it doesn't contatin classes from APC and phalcon is using only APC currently.

edited Jul '16

well they are both loaded

$ php -m
[PHP Modules]
apc
apcu
...

Is it possible that PHP-cli and regular PHP via http, are pointing to different storage of APC?

scenario1- PHP cli, I've tested SAVE|GET via apc, it worked, bit it didn't fetch any data that was stored via regular php scenario2- PHP web, also the same but it didn't fetch any data that I've stored via php-cli, could some explain my why?

edited Jul '16

Apc is not shared between php processes so yes. I would just recommend using memcache, apc is ancient technology from the days when php didn't have opcache tbh.

use:

sudo pecl install apcu_bc