Search code examples
cachingsymfony1symfony-1.4apc

Symfony built-in cache vs APC


I am going to optimise a symfony (1.4) project by caching. I don't know what should I use? Is it better to cache whole pages, components, partial using symfony built-in cache or to cache sql results by APC? What are pros and cons for each one?


Solution

  • I would say: use both.

    You can use Doctrine_Cache_Apc for all Doctrine queries, and use Symfony cache on complex actions/components.

    If you have a CMS, just remember to invalidate the cache so the user will see his editing "live". For example, on a save action in the CMS, you can use sfFileCache::removePattern to delete the cache files,then re-create cache files on-the-fly with sfWebBrowser::get .