All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
39 lines
742 B
PHP
39 lines
742 B
PHP
<?php
|
|
namespace Aws;
|
|
|
|
use Psr\Cache\CacheItemPoolInterface;
|
|
|
|
class PsrCacheAdapter implements CacheInterface
|
|
{
|
|
/** @var CacheItemPoolInterface */
|
|
private $pool;
|
|
|
|
public function __construct(CacheItemPoolInterface $pool)
|
|
{
|
|
$this->pool = $pool;
|
|
}
|
|
|
|
public function get($key)
|
|
{
|
|
$item = $this->pool->getItem($key);
|
|
|
|
return $item->isHit() ? $item->get() : null;
|
|
}
|
|
|
|
public function set($key, $value, $ttl = 0)
|
|
{
|
|
$item = $this->pool->getItem($key);
|
|
$item->set($value);
|
|
if ($ttl > 0) {
|
|
$item->expiresAfter($ttl);
|
|
}
|
|
|
|
$this->pool->save($item);
|
|
}
|
|
|
|
public function remove($key)
|
|
{
|
|
$this->pool->deleteItem($key);
|
|
}
|
|
}
|