单缓存前端和后端 [英] Single cache frontend and backend

查看:70
本文介绍了单缓存前端和后端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Yii中使用标签缓存.

I want to use tagging cache in Yii.

但是事实证明,对于前端来说,使用其缓存作为后端.当我确实在后端更改模型时,不会清除缓存的前端.有什么解决方案吗?

But it turns out that for the frontend using its cache for its backend. When I do change the model in the backend, the front of the cache is not cleared. There are any solutions for this?

对不起,我的英语.

推荐答案

在各自的配置文件中为前端和后端设置不同的缓存前缀.

Set distinct cache prefix for frontend and backend in their respective configuration files.

我仍在使用1.1.x分支,但是对于2.x分支应该是同一件事.

I am still using 1.1.x branch, but for 2.x branch should be the same thing.

前端配置文件:

'cache' => array(
        'class'     => 'system.caching.' . (!MW_DEBUG ? 'CFileCache' : 'CDummyCache'),
        'keyPrefix' => md5('frontend.' . MW_VERSION . Yii::getPathOfAlias('frontend')),
 ),

后端配置文件:

'cache' => array(
        'class'     => 'system.caching.' . (!MW_DEBUG ? 'CFileCache' : 'CDummyCache'),
        'keyPrefix' => md5('backend.' . MW_VERSION . Yii::getPathOfAlias('backend')),
    ),

这篇关于单缓存前端和后端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆