for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Gember\CachePsr\Test\TestDoubles;
use Psr\SimpleCache\CacheInterface;
use DateInterval;
final class TestPsrSimpleCache implements CacheInterface
{
/**
* @var array<string, array{mixed, int|DateInterval|null}>
array<string, array{mixe...int|DateInterval|null}>
6
*/
public array $data = [];
public function get(string $key, mixed $default = null): mixed
return $this->data[$key][0] ?? null;
}
public function set(string $key, mixed $value, DateInterval|int|null $ttl = null): bool
$this->data[$key] = [$value, $ttl];
return true;
public function delete(string $key): bool
// n/a
public function clear(): bool
public function getMultiple(iterable $keys, mixed $default = null): iterable
return [];
* @param iterable<mixed> $values
public function setMultiple(iterable $values, DateInterval|int|null $ttl = null): bool
public function deleteMultiple(iterable $keys): bool
public function has(string $key): bool
return isset($this->data[$key]);