src/Common/Traits/Caching.php
protected function unsetCachePrefix($sPrefix)
    {
        if (!static::$CACHING_ENABLED) {
            return false;
        } elseif (empty($sPrefix)) {
            return false;
        }

        $sPrefix = $this->getCachePrefix() . $sPrefix;

        // --------------------------------------------------------------------------

        //  Prep the key, the key should have a prefix unique to this model
        $aKeysToUnset = [];
        foreach ($this->aCache as $sCacheKey => $oCacheItem) {
            foreach ($oCacheItem->key as $sKey) {
                if (preg_match('/^' . preg_quote($sPrefix, '/') . '/', $sKey)) {
                    $aKeysToUnset[] = $sCacheKey;
                }
            }
        }

        foreach ($aKeysToUnset as $iKey) {
            unset($this->aCache[$iKey]);
        }

        // --------------------------------------------------------------------------

        return true;
    }
protected function unsetCachePrefix($sPrefix)
    {
        if (!static::$CACHING_ENABLED) {
            return false;
        } elseif (empty($sPrefix)) {
            return false;
        }

        $sPrefix = $this->getCachePrefix() . $sPrefix;

        // --------------------------------------------------------------------------

        //  Prep the key, the key should have a prefix unique to this model
        $aKeysToUnset = [];
        foreach ($this->aCache as $sCacheKey => $oCacheItem) {
            foreach ($oCacheItem->key as $sKey) {
                if (preg_match('/^' . preg_quote($sPrefix, '/') . '/', $sKey)) {
                    $aKeysToUnset[] = $sCacheKey;
                }
            }
        }

        foreach ($aKeysToUnset as $iKey) {
            unset($this->aCache[$iKey]);
        }

        // --------------------------------------------------------------------------

        return true;
    }
protected function unsetCachePrefix ( $ sPrefix ) { if ( ! static :: $ CACHING_ENABLED ) { return false ; } elseif ( empty ( $ sPrefix ) ) { return false ; } $ sPrefix = $ this -> getCachePrefix ( ) . $ sPrefix ; // -------------------------------------------------------------------------- //  Prep the key, the key should have a prefix unique to this model $ aKeysToUnset = [ ] ; foreach ( $ this -> aCache as $ sCacheKey => $ oCacheItem ) { foreach ( $ oCacheItem -> key as $ sKey ) { if ( preg_match ( '/^' . preg_quote ( $ sPrefix , '/' ) . '/' , $ sKey ) ) { $ aKeysToUnset [ ] = $ sCacheKey ; } } } foreach ( $ aKeysToUnset as $ iKey ) { unset ( $ this -> aCache [ $ iKey ] ) ; } // -------------------------------------------------------------------------- return true ; }
Deletes item from the cache which match a particular prefix

@param string $sPrefix The key prefix

@return bool
Deletes item from the cache which match a particular prefix