public function ClearCache(string $keyPattern = NULL)
    {
        if (GnApi::$Debug) {
            GnLogger::Verbose("Clear cache '{$keyPattern}'");
        }

        if (static::$CacheHandler) {
            static::$CacheHandler->deleteKey($keyPattern);
            static::$CacheHandler->deleteGroup($keyPattern);
        } else {
            $keys = $this->_memcached->getAllKeys();
            if (GnUtil::IsNullOrEmpty($keyPattern)) {
                // remove all items
                foreach ($keys as $key) {
                    $this->_memcached->delete($key);
                }
                return;
            }

            // remove key-patterns only
            foreach ($keys as $key) {
                $matches = array();
                $ret = preg_match("/" . preg_quote($keyPattern, '/') . "/", $key, $matches);
                if ($ret > 0) {
                    $this->_memcached->delete($key);
                }
            }
        }
    }
public function ClearCache(string $keyPattern = NULL)
    {
        if (GnApi::$Debug) {
            GnLogger::Verbose("Clear cache '{$keyPattern}'");
        }

        if (static::$CacheHandler) {
            static::$CacheHandler->deleteKey($keyPattern);
            static::$CacheHandler->deleteGroup($keyPattern);
        } else {
            $keys = $this->_memcached->getAllKeys();
            if (GnUtil::IsNullOrEmpty($keyPattern)) {
                // remove all items
                foreach ($keys as $key) {
                    $this->_memcached->delete($key);
                }
                return;
            }

            // remove key-patterns only
            foreach ($keys as $key) {
                $matches = array();
                $ret = preg_match("/" . preg_quote($keyPattern, '/') . "/", $key, $matches);
                if ($ret > 0) {
                    $this->_memcached->delete($key);
                }
            }
        }
    }
public function ClearCache ( string $ keyPattern = NULL ) { if ( GnApi :: $ Debug ) { GnLogger :: Verbose ( "Clear cache '{$keyPattern}'" ) ; } if ( static :: $ CacheHandler ) { static :: $ CacheHandler -> deleteKey ( $ keyPattern ) ; static :: $ CacheHandler -> deleteGroup ( $ keyPattern ) ; } else { $ keys = $ this -> _memcached -> getAllKeys ( ) ; if ( GnUtil :: IsNullOrEmpty ( $ keyPattern ) ) { // remove all items foreach ( $ keys as $ key ) { $ this -> _memcached -> delete ( $ key ) ; } return ; } // remove key-patterns only foreach ( $ keys as $ key ) { $ matches = array ( ) ; $ ret = preg_match ( "/" . preg_quote ( $ keyPattern , '/' ) . "/" , $ key , $ matches ) ; if ( $ ret > 0 ) { $ this -> _memcached -> delete ( $ key ) ; } } } }
Clears the items from the cache.

@param string $keyPattern The items to be cleared by a regexp-pattern of the key. If NULL, everything is removed.
Clears the items from the cache .