Execute an action

@param  string $action
@param  string $beforeEvent
@param  string $afterEvent
@param  CacheItemInterface $item
@return bool
@access protected
190941
protected function eventableAction(
        /*# string */ $action,
        /*# string */ $beforeEvent,
        /*# string */ $afterEvent,
        CacheItemInterface $item = null
    )/*# : bool */ {
        $param = ['item' => $item];
        if (!$this->trigger($beforeEvent, $param)) {
            return false;
        }
        if (!$this->driverAction($action, $item)) {
            $this->copyError($this->getDriver());
            return false;
        }
        if (!$this->trigger($afterEvent, $param)) {
            return false;
        }
        return $this->flushError();
    }
1242269
final public function beforePutItem(array &$item, Node $node): void
    {
        $this->loadIndexes();
        $this->addShardAttributes($item, $node);
        if ($node instanceof Indexed) {
            $item[NodeTable::INDEXED_KEY_NAME] = ['BOOL' => true];
        }

        foreach ($this->gsi as $gsi) {
            $gsi->beforePutItem($item, $node);
        }

        $this->doBeforePutItem($item, $node);
    }
748796
public function beforeAfter($command, $path = '', $namespace = '')
    {
        if (! is_null($command)) {
            if (is_array($command)) {
                foreach ($command as $key => $value) {
                    $this->beforeAfter($value, $path, $namespace);
                }
            } elseif (is_string($command)) {
                $controller = $this->resolveClass($command, $path, $namespace);
                if (method_exists($controller, 'handle')) {
                    return call_user_func([$controller, 'handle']);
                }

                return $this->exception('handle() method is not found in <b>'.$command.'</b> class.');
            }
        }

        return;
    }
556074
protected function storeItemInCache(CacheItemInterface $item)
    {
        $this->cache->setRawValue(
            $this->getHierarchyKey($item->getKey()),
            $item->get(),
            $item->getTags(),
            $item->getExpirationTimestamp()
        );
    }
124157
protected function executeRebuildActions($action = 'beforeRebuild')
    {
        if (!isset($this->rebuildActionClasses)) {
            $this->initRebuildActions();
        }

        if (isset($this->rebuildActionClasses[$action])) {
            foreach ($this->rebuildActionClasses[$action] as $rebuildActionClass) {
                $rebuildActionClass->$action();
            }
        }
    }
995716
public function save(CacheItemInterface $item)
    {
        $this->connect();

        $ttl = $this->ttl;

        $this->driver->set($item->getKey(), $item->get(), $ttl);

        return (bool) ($this->driver->getResultCode() == \Memcached::RES_SUCCESS);
    }
922274
protected final function poolDeleteItem(CacheItemInterface $item): bool
    {
         return is_file($this->includePath . $item->getKey())
             && unlink($this->includePath . $item->getKey());
    }
534881
public function beforeAction($action)
    {
        Yii::$app->response->format = Response::FORMAT_HTML;
        return parent::beforeAction($action);
    }
1273941
public function beforeFilter($event)
    {
        $this->Controller->authUser = $this->Controller->Auth->user();

        // beforeFilter-event
        $_event = new Event('Component.Manager.beforeFilter', $this, [
        ]);
        $this->Controller->eventManager()->dispatch($_event);

        // beforeFilter-event for prefixes
        if ($this->isPrefix()) {
            $this->_runCallback("beforeFilter", $event);

            // beforeFilter-event with Prefix
            $this->_runEvent("beforeFilter");
        }

        $this->__loadHelpers();
    }
1326898
private function triggerActionEvent($instance, $action, $type = 'before')
    {
        if (method_exists($instance, $type . ucfirst($action))) {
            call_user_func([$instance, $type . ucfirst($action)]);
        }
    }
1135232
public function cache(CacheItemInterface $item)
    {
        $content = $this->execute();
        $item->set($content);

        return $item;
    }
831989
private function isExpired(CacheItemInterface $item, DateTime $time = null)
    {
        $time = $time ?: new DateTime();
        return ($time > $item->getExpiresAt());
    }
468370
public function queue($item_id = null, $action = null)
    {

        if( is_null($item_id) ) {
            throw new NoItemException("No item id was sent");
        } else if ( ! is_numeric($item_id) ){
            throw new InvalidItemTypeException("The item id: $item_id is not valid it should be a number");
        }

        $this->actions[] =
            array(
                'action'        => $action,
                'item_id'       => $item_id,
                'time'          => time()
            );

        return true;

    }
880742
private function beforeAfterControllerAction(string $when): void
    {
        $method = $when.\ucfirst($this->routeAction);

        if (\method_exists($this->controller, $method) && $method !== $when) {
            \call_user_func([$this->controller, $method]);
        }
    }
844802
public function isCached(CacheItemInterface $item = null)
    {
        if (!$item) {
            $key = $this->getCurrentKey();
            $item = $this->getItemStorage()->get($key);
        }

        return $item ? true : false;
    }
1018165
public static <T> void fire(final HasBeforeItemRemoveHandlers<T> source, T item) {
        if (TYPE != null) {
            BeforeItemRemoveEvent<T> event = new BeforeItemRemoveEvent<T>(item);
            source.fireEvent(event);
        }
    }
263233
public static function beforeActionAccess($event)
    {
        $controller = $event->sender;
        $permissionName = AuthItem::createPermissionName([$controller->module->id, $controller->id, $controller->action->id]);
        if (!AuthItem::checkAccess($permissionName, Yii::$app->user)) {
            throw new HttpException(403, Yii::t('modules/rbac', 'Access denied'));
        }
    }