简体   繁体   English

教义缓存Symfony2 deleteByPrefix

[英]Doctrine Cache Symfony2 deleteByPrefix

I would like to delete all my cache entries prefixed by a string, but my code returns : 我想删除所有以字符串开头的缓存条目,但是我的代码返回:

Fatal error: Call to undefined method Doctrine\Common\Cache\FilesystemCache::deleteByPrefix()

and my code is 我的代码是

$deleted = $cachemanager->deleteByPrefix('catalog_');

like where I checked : into the documentation of doctrine http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/caching.html#deleting . 就像我在哪里检查:进入该学说的文档http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/caching.html#deleting

I need to clear the cache since controller, not from CLI... 由于控制器而不是CLI,我需要清除缓存...

Does someone as an alternative to this method 'deleteByPrefix()' ? 是否有人可以替代此方法'deleteByPrefix()'?

You can use the namespace. 您可以使用名称空间。 This will require reorganizing your caches. 这将需要重新组织缓存。 Or you can write your own implementation (extending Doctrine\\Common\\Cache\\FilesystemCache) which will implement deleteByPrefix(), but you'll use the ability to simply switch cache provider. 或者,您可以编写自己的实现(扩展Doctrine \\ Common \\ Cache \\ FilesystemCache),该实现将实现deleteByPrefix(),但是您将使用此功能来简单地切换缓存提供程序。

最后,我来使用Zend Framework缓存捆绑包,该捆绑包允许按前缀删除...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM