src/Adapter/FileCache.php
public function get($key)
    {
        if (! $this->enabled) {
            return;
        }
        $file = $this->getPath($key);
        if (! file_exists($file)) {
            return false;
        }

        set_error_handler(function () {
            throw new Exception('An error occurred.');
        }, E_WARNING);

        try {
            if (filemtime($file) < time()) {
                throw new Exception('Term life data has expired.');
            }
            $data = file_get_contents($file);
        } catch (Exception $ex) {
            restore_error_handler();
            $this->remove($key);

            return false;
        }
        restore_error_handler();

        return call_user_func($this->restoringFilter, $data);
    }
public function get($key)
    {
        if (! $this->enabled) {
            return;
        }
        $file = $this->getPath($key);
        if (! file_exists($file)) {
            return false;
        }

        set_error_handler(function () {
            throw new Exception('An error occurred.');
        }, E_WARNING);

        try {
            if (filemtime($file) < time()) {
                throw new Exception('Term life data has expired.');
            }
            $data = file_get_contents($file);
        } catch (Exception $ex) {
            restore_error_handler();
            $this->remove($key);

            return false;
        }
        restore_error_handler();

        return call_user_func($this->restoringFilter, $data);
    }
public function get ( $ key ) { if ( ! $ this -> enabled ) { return ; } $ file = $ this -> getPath ( $ key ) ; if ( ! file_exists ( $ file ) ) { return false ; } set_error_handler ( function ( ) { throw new Exception ( 'An error occurred.' ) ; } , E_WARNING ) ; try { if ( filemtime ( $ file ) < time ( ) ) { throw new Exception ( 'Term life data has expired.' ) ; } $ data = file_get_contents ( $ file ) ; } catch ( Exception $ ex ) { restore_error_handler ( ) ; $ this -> remove ( $ key ) ; return false ; } restore_error_handler ( ) ; return call_user_func ( $ this -> restoringFilter , $ data ) ; }
Gets a stored variable from the cache.

@param string $key The variable name

@return mixed Returns null if adapter is disabled, stored data on success,
false otherwise
Gets a stored variable from the cache .