protected function deleteMappedKey($key, $value = null, $level=0)
    {
        if (is_null($value)) {
            $value = $this->getDriver()->get($key);
        }

        if ($level > 0) {
            $key = $key . self::LEVEL_SEPARATOR . $level;
        }

        $success = true;

        if ($this->isSplit($value)) {

            $valueParts = [];
            foreach ($this->unSerializeMap($value) as $mappedKey) {
                $mappedKey = $this->transformReferenceToMappedKey($mappedKey);
                $valueParts[$this->getMappedKeyIndex($mappedKey, $key)] = $this->getDriver()->get($mappedKey);
                $success = $success && $this->getDriver()->del($mappedKey);
            }

            uksort($valueParts, 'strnatcmp');
            $value = implode('', $valueParts);
            if ($this->isSplit($value)) {
                $success = $success && $this->deleteMappedKey($key, $value, $level + 1);
            }

        }
        return $success;
    }
protected function deleteMappedKey($key, $value = null, $level=0)
    {
        if (is_null($value)) {
            $value = $this->getDriver()->get($key);
        }

        if ($level > 0) {
            $key = $key . self::LEVEL_SEPARATOR . $level;
        }

        $success = true;

        if ($this->isSplit($value)) {

            $valueParts = [];
            foreach ($this->unSerializeMap($value) as $mappedKey) {
                $mappedKey = $this->transformReferenceToMappedKey($mappedKey);
                $valueParts[$this->getMappedKeyIndex($mappedKey, $key)] = $this->getDriver()->get($mappedKey);
                $success = $success && $this->getDriver()->del($mappedKey);
            }

            uksort($valueParts, 'strnatcmp');
            $value = implode('', $valueParts);
            if ($this->isSplit($value)) {
                $success = $success && $this->deleteMappedKey($key, $value, $level + 1);
            }

        }
        return $success;
    }
protected function deleteMappedKey ( $ key , $ value = null , $ level = 0 ) { if ( is_null ( $ value ) ) { $ value = $ this -> getDriver ( ) -> get ( $ key ) ; } if ( $ level > 0 ) { $ key = $ key . self :: LEVEL_SEPARATOR . $ level ; } $ success = true ; if ( $ this -> isSplit ( $ value ) ) { $ valueParts = [ ] ; foreach ( $ this -> unSerializeMap ( $ value ) as $ mappedKey ) { $ mappedKey = $ this -> transformReferenceToMappedKey ( $ mappedKey ) ; $ valueParts [ $ this -> getMappedKeyIndex ( $ mappedKey , $ key ) ] = $ this -> getDriver ( ) -> get ( $ mappedKey ) ; $ success = $ success && $ this -> getDriver ( ) -> del ( $ mappedKey ) ; } uksort ( $ valueParts , 'strnatcmp' ) ; $ value = implode ( '' , $ valueParts ) ; if ( $ this -> isSplit ( $ value ) ) { $ success = $ success && $ this -> deleteMappedKey ( $ key , $ value , $ level + 1 ) ; } } return $ success ; }
Delete a key and if the value is a map, delete all mapped key recursively

@param $key
@param null $value
@param int $level
@return bool
Delete a key and if the value is a map delete all mapped key recursively