public function clearByTag(
        CachePoolInterface $cache,
        /*# string */ $tag
    )/*# : bool */ {
        // get tagItem for $tag
        $tagKey  = $this->getTagKey($tag);
        $tagItem = $cache->getItem($tagKey);

        // read array of keys from $tagItem
        if ($tagItem->isHit()) {
            $keyArray = $tagItem->get();
            foreach (array_keys($keyArray) as $key) {
                if ($cache->deleteItem($key)) {
                    unset($keyArray[$key]);
                }
            }

            // get error
            if (count($keyArray)) {
                $this->setError(
                    $cache->getError(),
                    $cache->getErrorCode()
                );
            }

            // update tagItem
            $tagItem->set($keyArray);
            $tagItem->expiresAfter($this->tag_life); // one year
            $cache->save($tagItem);

            if (count($keyArray)) {
                return false;
            }
        }

        return $this->trueAndFlushError();
    }
public function clearByTag(
        CachePoolInterface $cache,
        /*# string */ $tag
    )/*# : bool */ {
        // get tagItem for $tag
        $tagKey  = $this->getTagKey($tag);
        $tagItem = $cache->getItem($tagKey);

        // read array of keys from $tagItem
        if ($tagItem->isHit()) {
            $keyArray = $tagItem->get();
            foreach (array_keys($keyArray) as $key) {
                if ($cache->deleteItem($key)) {
                    unset($keyArray[$key]);
                }
            }

            // get error
            if (count($keyArray)) {
                $this->setError(
                    $cache->getError(),
                    $cache->getErrorCode()
                );
            }

            // update tagItem
            $tagItem->set($keyArray);
            $tagItem->expiresAfter($this->tag_life); // one year
            $cache->save($tagItem);

            if (count($keyArray)) {
                return false;
            }
        }

        return $this->trueAndFlushError();
    }
public function clearByTag ( CachePoolInterface $ cache , /*# string */ $ tag ) /*# : bool */ { // get tagItem for $tag $ tagKey = $ this -> getTagKey ( $ tag ) ; $ tagItem = $ cache -> getItem ( $ tagKey ) ; // read array of keys from $tagItem if ( $ tagItem -> isHit ( ) ) { $ keyArray = $ tagItem -> get ( ) ; foreach ( array_keys ( $ keyArray ) as $ key ) { if ( $ cache -> deleteItem ( $ key ) ) { unset ( $ keyArray [ $ key ] ) ; } } // get error if ( count ( $ keyArray ) ) { $ this -> setError ( $ cache -> getError ( ) , $ cache -> getErrorCode ( ) ) ; } // update tagItem $ tagItem -> set ( $ keyArray ) ; $ tagItem -> expiresAfter ( $ this -> tag_life ) ; // one year $ cache -> save ( $ tagItem ) ; if ( count ( $ keyArray ) ) { return false ; } } return $ this -> trueAndFlushError ( ) ; }
Clear by tags

@param  CachePoolInterface $cache
@param  string $tag tag
@return bool
@access public
Clear by tags