for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Shamaseen\Repository\Utility\Models;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Psr\SimpleCache\InvalidArgumentException;
class RequestCache
{
public string $key;
public function __construct($key)
$this->key = $key;
}
/**
* @throws InvalidArgumentException
*/
private function getRepositoryCacheCollection(): Collection
return Cache::store('array')->get($this->key, collect([]));
public function get($key, $default = null)
return $this->getRepositoryCacheCollection()->get($key, $default);
public function set($key, $value): bool
return Cache::store('array')->set(
$this->key,
$this->getRepositoryCacheCollection()->put($key, $value)
);
public function delete(array|string|int $key): bool
$this->getRepositoryCacheCollection()->forget($key)
public function clear(): bool
collect([])
public function all(): array
return $this->getRepositoryCacheCollection()->all();