codin/stash

0.1.1 2022-03-22 04:17 UTC

This package is auto-updated.

Last update: 2024-10-28 21:31:53 UTC


README

version workflow license

Example

use Codin\Stash\{
	Item,
	Adapter\RedisPool
    Adapter\Redis\ConnectionResolver
};

$resolver = new ConnectionResolver(static function () {
    return new Redis();
});
$pool = new RedisPool($resolver);

$item = new Item('my-key', 'some data');
$item->expiresAfter(3600); // 1 hour

$pool->save($item);

$item = $pool->getItem('my-key');
echo $item->get(); // some data
echo $item->isHit(); // true

Testing

php bin/phpstan
php bin/phpspec run