Cross application clear cache partials using sfAPCCache – symfony 1.4

Remember to have the prefix set in your factories.yml:

all:
  view_cache_manager:
    class: sfViewCacheManager
    param:
      cache_key_use_vary_headers: true
      cache_key_use_host_name:    true

  view_cache:
    class: sfAPCCache
    param:
      prefix: frontend
 

Remember also to have the cache: true on the settings.yml:

dev:
  .settings:
    cache:                  true
    …
 

Having this, you can remove the cache from APC in your backend application using something like this:

  protected function doSave($con = null)
  {

    // removing cache
    $cache = new sfAPCCache(array(‘prefix’ => ‘frontend’));
    $cache->removePattern(‘*/all/page/article/sf_format/html/slug/’.$this->values[‘slug’], ‘*’);

    parent::doSave($con);  // continue with the parent save()
  }