Skip to content

Latest commit

 

History

History
44 lines (26 loc) · 567 Bytes

README.md

File metadata and controls

44 lines (26 loc) · 567 Bytes

Phore Cache

Installation

composer require phore/cache

Basic usage

Setting a driver:

$pool = new CacheItemPool(new RedisCacheDriver("redis://redis"));

or shortcut:

$pool = new CacheItemPool("redis://redis");

Load and cache data

$pool = new CacheItemPool("redis://redis");
$item = $pool->getItem("cachekey")->expiresAfter(10)->retryAfter(5);
echo $item->load(function () {
    return "Data"; // Put code to load the cached value
});

Filesystem driver

$pool = new CacheItemPool("file:///tmp");