Yii2: Flushing cache not working for ApcCache

Created on 30 Dec 2015  路  17Comments  路  Source: yiisoft/yii2

I used yii\filters\PageCache to cache some actions and ApcCache is being used. When i run yii cache/flush-all, the page is still cached. I even cleared the runtime folder and still nothing.

to be verified docs

Most helpful comment

Documented.

All 17 comments

APC or APCu?

APC.

What's PHP version?

PHP 5.6.4-4ubuntu6.4 (cli) (built: Oct 28 2015 01:21:29)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies

Wait, you have OpCache, right? Are you sure you're using APC and not APCu?

Just checked it, yep it's APCu.

Do you have cache configured for your console app?

The cache config is in my common configuration. So it's for everything. Should i move it?

No, that should be fine.

So anything i can do to fix this?

Don't know. I see no obvious mistakes. Will check it after 2.0.7 release.

Ok that seems good.

Not time to verify for 2.0.8, moving to next release.

http://stackoverflow.com/questions/12860487/is-apc-opcode-cache-shared-between-php-fpm-pools-workers

Internet has a lot of discussions that calling apc_cache_clear() in CLI does not clear opcode caches from "web" PHP processes, whether they are run inside Apache or by FPM (see How to clear APC cache entries? ). As a suggested solution, it's possible to create a simple PHP page that calls apc_cache_clear(), and call that from CLI.

thanks @rob006

This definitely should be documented. AFAIK APC(u) cache doesn't really work in CLI, because CLI process can not share cache with other process. So each command use only cache which itself generated.

Documented.

Was this page helpful?
0 / 5 - 0 ratings