Search code examples
phpcachingsymfony1symfony-1.4apc

How to add custom behaviour to symfony cache:clear?


I need to add a simple call to (new sfAPCCache())->clean(), or to apc_clear_cache() when the command ./symfony cc is performed.

Anyone knows how to achieve this? In which point should I edit my symfony application, or how should i register this additional behavior?


Solution

  • Actually, I discovered that I can listen to an event to add new behavior to ./symfony cc:

    $this->dispatcher->connect('task.cache.clear', array('ClearAPCCache','clearCache'))
    

    Remains the problem that is not possibile to clear the APC cache from a command-line task because APC cache is related to the web server process, while the symfony command is a command-line script.