src/PhpSigep/Cache/Storage/Adapter/FileSystem.php
protected function getFileSpec($normalizedKey)
    {
        $options   = $this->getOptions();
        $namespace = $options->getNamespace();
        $prefix    = ($namespace === '') ? '' : $namespace . $options->getNamespaceSeparator();
        $path      = $options->getCacheDir() . DIRECTORY_SEPARATOR;
        $level     = $options->getDirLevel();

        $fileSpecId = $path . $prefix . $normalizedKey . '/' . $level;
        if ($this->lastFileSpecId !== $fileSpecId) {
            if ($level > 0) {
                // create up to 256 directories per directory level
                $hash = md5($normalizedKey);
                for ($i = 0, $max = ($level * 2); $i < $max; $i += 2) {
                    $path .= $prefix . $hash[$i] . $hash[$i + 1] . DIRECTORY_SEPARATOR;
                }
            }

            $this->lastFileSpecId = $fileSpecId;
            $this->lastFileSpec   = $path . $prefix . $normalizedKey;
        }

        return $this->lastFileSpec;
    }
protected function getFileSpec($normalizedKey)
    {
        $options   = $this->getOptions();
        $namespace = $options->getNamespace();
        $prefix    = ($namespace === '') ? '' : $namespace . $options->getNamespaceSeparator();
        $path      = $options->getCacheDir() . DIRECTORY_SEPARATOR;
        $level     = $options->getDirLevel();

        $fileSpecId = $path . $prefix . $normalizedKey . '/' . $level;
        if ($this->lastFileSpecId !== $fileSpecId) {
            if ($level > 0) {
                // create up to 256 directories per directory level
                $hash = md5($normalizedKey);
                for ($i = 0, $max = ($level * 2); $i < $max; $i += 2) {
                    $path .= $prefix . $hash[$i] . $hash[$i + 1] . DIRECTORY_SEPARATOR;
                }
            }

            $this->lastFileSpecId = $fileSpecId;
            $this->lastFileSpec   = $path . $prefix . $normalizedKey;
        }

        return $this->lastFileSpec;
    }
protected function getFileSpec ( $ normalizedKey ) { $ options = $ this -> getOptions ( ) ; $ namespace = $ options -> getNamespace ( ) ; $ prefix = ( $ namespace === '' ) ? '' : $ namespace . $ options -> getNamespaceSeparator ( ) ; $ path = $ options -> getCacheDir ( ) . DIRECTORY_SEPARATOR ; $ level = $ options -> getDirLevel ( ) ; $ fileSpecId = $ path . $ prefix . $ normalizedKey . '/' . $ level ; if ( $ this -> lastFileSpecId !== $ fileSpecId ) { if ( $ level > 0 ) { // create up to 256 directories per directory level $ hash = md5 ( $ normalizedKey ) ; for ( $ i = 0 , $ max = ( $ level * 2 ) ; $ i < $ max ; $ i += 2 ) { $ path .= $ prefix . $ hash [ $ i ] . $ hash [ $ i + 1 ] . DIRECTORY_SEPARATOR ; } } $ this -> lastFileSpecId = $ fileSpecId ; $ this -> lastFileSpec = $ path . $ prefix . $ normalizedKey ; } return $ this -> lastFileSpec ; }
Get file spec of the given key and namespace

@param  string $normalizedKey
@return string
Get file spec of the given key and namespace