Creating your own cache driver
Step 1: Implement the CacheInterface
namespace Midnite81\Guardian\Contracts\Store;
use DateInterval;
use DateTimeInterface;
interface CacheInterface
{
public function get(string $key, mixed $default = null): mixed;
public function has(string $key): bool;
public function put(string $key, mixed $value, DateInterval|DateTimeInterface|int|null $ttl = null): bool;
public function forget(string $key): bool;
}Step 2: Create Your Custom Cache Driver
Step 3: Implement the Required Methods
Step 4: Use Your Custom Cache Driver
Best Practices
Last updated