Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 486 Bytes

cache.md

File metadata and controls

29 lines (20 loc) · 486 Bytes

Cache

The cache currently ships with a file-based caching storage. More to come.

Storage

  • Vision\Cache\Storage\File: File-based

Usage

use Vision\Cache;
use Vision\Cache\Storage\File as FileStorage;

$options = array(
    'cache_dir' => __DIR__ . '/cache'
);

$storage = new FileStorage($options);
$cache = new Cache($storage);

$cache->set('foo', 'bar', 10);
var_dump ($cache->get('foo'));
// string(3) "bar"

sleep(15);

var_dump ($cache->get('foo'));
// NULL