src/Directory.php
/**
     * Save the expiration time of a cache
     *
     * @param string $key the cache key
     * @param false|int $ttl The TTL of the cache
     */
Save the expiration time of a cache
@param string $key the cache key
@param false|int $ttl The TTL of the cache
Save the expiration time of a cache @param string $key the cache key @param false|int $ttl The TTL of the cache
protected function saveExpire($key, $ttl)
    {
        $baseKey = base64_encode($key);
        $path = $this->getTtlPath($key);
        $this->buildPath(dirname($path));
        $expires = array();
        if (file_exists($path) && is_file($path)) {
            $expires = json_decode($this->readFile($path), true);
        }
        if ($ttl === false) {
            if (array_key_exists($baseKey, $expires)) {
                unset($expires[$baseKey]);
            } else {
                return;
            }
        } else {
            $expires[$baseKey] = time() + $ttl;
        }
        file_put_contents($path, json_encode($expires), $this->getOption('locking') ? LOCK_EX : null);
    }
protected function saveExpire ( $ key , $ ttl ) { $ baseKey = base64_encode ( $ key ) ; $ path = $ this -> getTtlPath ( $ key ) ; $ this -> buildPath ( dirname ( $ path ) ) ; $ expires = array ( ) ; if ( file_exists ( $ path ) && is_file ( $ path ) ) { $ expires = json_decode ( $ this -> readFile ( $ path ) , true ) ; } if ( $ ttl === false ) { if ( array_key_exists ( $ baseKey , $ expires ) ) { unset ( $ expires [ $ baseKey ] ) ; } else { return ; } } else { $ expires [ $ baseKey ] = time ( ) + $ ttl ; } file_put_contents ( $ path , json_encode ( $ expires ) , $ this -> getOption ( 'locking' ) ? LOCK_EX : null ) ; }
Save the expiration time of a cache
 @param string $key the cache key
 @param false|int $ttl The TTL of the cache
Save the expiration time of a cache @param string $key the cache key @param false|int $ttl The TTL of the cache