Clear event - clear all cache by tags

@param Zend_EventManager_EventDescription $event
764869
public function clean(\Zend_EventManager_EventDescription $event)
    {      
        $params = $event->getParams();
        $mode = \Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG;

        if (isset($params['mode'])) {
            $mode = $params['mode'];   
        }

        return $this->cache->clean($mode, $this->_getTags($event));
    }
516624
protected function _clearCache( array $ids )
	{
		$domain = str_replace( '_', '/', strtolower( $this->_name ) );
		$tags = array( $domain );

		foreach( $ids as $id ) {
			$tags[] = $domain . '-' . $id;
		}

		$this->_context->getCache()->deleteByTags( $tags );
	}
867431
public function beforeDeleteTree(Event $event)
    {
        if ($children = $this->getChildren()->all()) {
            foreach ($children as $childNode) {
                $childNode->delete();
            }
        }
    }
547971
public function onFlushContent(Event $event)
    {
        // Checks if page caching is available
        $this->object = $event->getTarget();
        if (false === ($this->object instanceof AbstractClassContent) || false === $this->checkCacheContentEvent(false)) {
            return;
        }

        $parent_uids = $this->application->getEntityManager()
            ->getRepository('BackBee\ClassContent\Indexes\IdxContentContent')
            ->getParentContentUids(array($this->object))
        ;

        $content_uids = array_diff($parent_uids, $this->content_cache_deletion_done);
        if (0 === count($content_uids)) {
            return;
        }

        $this->cache_content->removeByTag($content_uids);
        $this->content_cache_deletion_done = array_merge($this->content_cache_deletion_done, $content_uids);
        $this->application->debug(sprintf(
            'Remove cache for `%s(%s)`.',
            get_class($this->object),
            implode(', ', $content_uids)
        ));

        if (false === $this->application->getContainer()->has('cache.page')) {
            return;
        }

        $cachePage = $this->application->getContainer()->get('cache.page');
        if ($cachePage instanceof CacheExtendedInterface) {
            $node_uids = $this->application->getEntityManager()
                ->getRepository('BackBee\ClassContent\Indexes\IdxContentContent')
                ->getNodeUids($content_uids)
            ;
            $cachePage->removeByTag($node_uids);
            $this->application->debug(sprintf('Remove cache for page %s.', implode(', ', $node_uids)));
        }
    }
1260540
public function handleReplaceInsertTags(ReplaceInsertTagsEvent $event)
    {
        /** @var Controller $controllerAdapter */
        $controllerAdapter = $this->framework->getAdapter(Controller::class);

        $result = $controllerAdapter->replaceInsertTags($event->getBuffer(), $event->isCachingAllowed());

        $event->setBuffer($result);
    }
527003
public function invalidateTags($event = null)
    {
        /** @var TagDependencyTrait $this */
        $oldFields = $event !== null && $event->name === ActiveRecord::EVENT_AFTER_UPDATE ? $event->changedAttributes : [];
        \yii\caching\TagDependency::invalidate(
            $this->getTagDependencyCacheComponent(),
            [
                static::commonTag(),
                $this->objectTag($oldFields)
            ]
        );

        if ($this->cacheCompositeTagFields()) {
            \yii\caching\TagDependency::invalidate(
                $this->getTagDependencyCacheComponent(),
                $this->objectCompositeTag($oldFields)
            );
        }

        return true;
    }
197200
public function onDelete(GenericDataEvent $event)
    {
        /** @var Group[] $groups */
        $groups = $event->getData();

        $ids = [];
        foreach ($groups as $group) {
            $ids[] = $group->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(Group::class, $ids);
    }
791961
public function clearCache(CachedFileEvent $event)
    {
        $path = $this->getCachePath($event->getCacheSubdirectory(), false);

        $this->clearDirectory($path);
    }
218366
public function onDelete(GenericDataEvent $event)
    {
        /** @var ResourceNode[] $resources */
        $resources = $event->getData();

        $ids = [];
        foreach ($resources as $resource) {
            $ids[] = $resource->getId();
        }

        $this->manager->removeTaggedObjectsByClassAndIds(ResourceNode::class, $ids);
    }
722735
public static function clearCache()
    {
        if (self::$_cacheTags) {
            self::$_cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('Zend_Locale'));
        } else {
            self::$_cache->clean(Zend_Cache::CLEANING_MODE_ALL);
        }
    }
1348087
public function onQuit(Event $event)
    {
        $msg = $event->getMessage();

        if (!isset($msg['nick'])) {
            return;
        }

        $nick = $msg['nick'];

        $this->storage->removeUser($nick);
    }
821996
public function remove(EventInterface $event)
    {
        foreach ($this->events as $key => $internalEvent) {
            if ($event->getUid() === $internalEvent->getUid()) {
                unset($this->events[$key]);
            }
        }
    }
998842
public function remove(EventInterface $event)
    {
        $index = $this->computeIndex($event);
        if (isset($this->events[$index])) {
            foreach ($this->events[$index] as $key => $internalEvent) {
                if ($event->getUid() == $internalEvent->getUid()) {
                    unset($this->events[$index][$key]);
                    --$this->count;
                }
            }
        }
    }
1095476
public static function invalidate_by_event($event, array $keys) {
        $instance = cache_config::instance();
        $invalidationeventset = false;
        $factory = cache_factory::instance();
        $inuse = $factory->get_caches_in_use();
        $purgetoken = null;
        foreach ($instance->get_definitions() as $name => $definitionarr) {
            $definition = cache_definition::load($name, $definitionarr);
            if ($definition->invalidates_on_event($event)) {
                // First up check if there is a cache loader for this definition already.
                // If there is we need to invalidate the keys from there.
                $definitionkey = $definition->get_component().'/'.$definition->get_area();
                if (isset($inuse[$definitionkey])) {
                    $inuse[$definitionkey]->delete_many($keys);
                }

                // We should only log events for application and session caches.
                // Request caches shouldn't have events as all data is lost at the end of the request.
                // Events should only be logged once of course and likely several definitions are watching so we
                // track its logging with $invalidationeventset.
                $logevent = ($invalidationeventset === false && $definition->get_mode() !== cache_store::MODE_REQUEST);

                if ($logevent) {
                    // Get the event invalidation cache.
                    $cache = cache::make('core', 'eventinvalidation');
                    // Get any existing invalidated keys for this cache.
                    $data = $cache->get($event);
                    if ($data === false) {
                        // There are none.
                        $data = array();
                    }
                    // Add our keys to them with the current cache timestamp.
                    if (null === $purgetoken) {
                        $purgetoken = cache::get_purge_token(true);
                    }
                    foreach ($keys as $key) {
                        $data[$key] = $purgetoken;
                    }
                    // Set that data back to the cache.
                    $cache->set($event, $data);
                    // This only needs to occur once.
                    $invalidationeventset = true;
                }
            }
        }
    }
363598
public function removeListener($event, $listener)
    {
        if (! $this->hasListener($event)) {
            return;
        }

        $event = $this->getEventName($event);
        $listeners = $this->listeners[$event];

        foreach ($listeners as $priority => $registed) {
            $listeners[$priority] = array_filter($registed, function ($reg) use ($listener) {
                return ! $reg->isListener($listener);
            });
        }

        $this->listeners[$event] = $listeners;

        unset($this->sortedListeners[$event], $listeners, $event);
    }
586343
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $this->indexer->remove($document);
        $this->indexer->flush();
    }
412138
public function sendEvent(Event $event)
    {
        try {
            $this->eventFactory->addDefaultTagsToEntity($event);
            $this->sendEventThroughSenders($event);
        } catch (\Exception $exception) {
            $this->logException($exception);
        }
    }