简体   繁体   中英

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 .

I need to clear the cache since controller, not from CLI...

Does someone as an alternative to this method '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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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