codin/stash

0.1.1 2022-03-22 04:17 UTC

This package is auto-updated.

Last update: 2024-08-28 21:10:43 UTC


README

version workflow license

示例

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

测试

php bin/phpstan
php bin/phpspec run