Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TagDependency invalidate in console #15350

Open
nicdnepr opened this issue Dec 13, 2017 · 5 comments
Open

TagDependency invalidate in console #15350

nicdnepr opened this issue Dec 13, 2017 · 5 comments
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug

Comments

@nicdnepr
Copy link
Contributor

What steps will reproduce the problem?

I have basic app with same id and cache
part config web.php

'id' => 'basic',
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],

part config console.php

'id' => 'basic',
    'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],

in web app I use cache

$kurs = Yii::$app->db->cache(function() {
            return static::find()->limit(1)->asArray()->one();
        }, Yii::$app->params['cache'], new TagDependency(['tags' => 'kurs']));

in console I reset cache

TagDependency::invalidate(\Yii::$app->cache, 'kurs');

What is the expected result?

reset cache in web

What do you get instead?

cache not resets
but in web TagDependency::invalidate works good

Additional info

Q A
Yii version 2.0.13.1
PHP version 7
Operating system ubuntu 16
@samdark samdark added the status:to be verified Needs to be reproduced and validated. label Dec 13, 2017
@samdark samdark added this to the 2.0.16 milestone Dec 13, 2017
@samdark samdark added the type:bug Bug label Feb 3, 2018
@cebe
Copy link
Member

cebe commented May 13, 2018

is basePath of both applications the same? i.e. do they both use the same runtime path? If not you need to configure FileCache to use the same path.

@nicdnepr
Copy link
Contributor Author

Its default app with default settings, guess runtime same

@free6k
Copy link

free6k commented May 18, 2018

I have similar problem... Yii::app->cache is Redis... Yii 2.0.12. TagDependency from console not reset cache... I think about the id in config, but this dont have result

@samdark samdark removed this from the 2.0.17 milestone Mar 20, 2019
@B0rner
Copy link

B0rner commented Aug 29, 2023

Same here, using memcached and TagDependency in Yii2 web-application.
People using redis as caching-engine has the same problem reported under this issue: yiisoft/yii2-redis#156

@flaviovs
Copy link

Having the same issue with TagDependency here. invalidate() call does not invalidate anything when called from my console application, whereas the same call works in the web app. Web and console app use the same cache back-end configuration (memcached). Everything else related to caching (cache proper, schema caching, flush, etc.) works fine in both web and console app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug
Projects
None yet
Development

No branches or pull requests

6 participants