*/ class Cache extends BaseAction implements EventSubscriberInterface { /** @var AdapterInterface */ protected $adapter; /** * CacheListener constructor. * @param AdapterInterface $adapter */ public function __construct(AdapterInterface $adapter) { $this->adapter = $adapter; } public function cacheClear(CacheEvent $event) { // clear cache on thelia.cache service $this->adapter->clear(); $dir = $event->getDir(); $fs = new Filesystem(); $fs->remove($dir); } /** * {@inheritdoc} */ public static function getSubscribedEvents() { return array( TheliaEvents::CACHE_CLEAR => array('cacheClear', 128) ); } }