phore/cache

Caching library

Installs: 1 691

Dependents: 3

Suggesters: 2

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 0

pkg:composer/phore/cache

v1.0 2019-12-02 17:27 UTC

This package is auto-updated.

Last update: 2025-09-10 21:30:32 UTC


README

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");