mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-14 02:27:23 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
38
aws/Aws/PsrCacheAdapter.php
Normal file
38
aws/Aws/PsrCacheAdapter.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue