Skip to content

Latest commit

 

History

History
36 lines (26 loc) · 742 Bytes

File metadata and controls

36 lines (26 loc) · 742 Bytes

marko/cache-redis

Redis cache driver --- fast, persistent caching backed by Redis for production workloads.

Installation

composer require marko/cache-redis

Quick Example

use Marko\Cache\Contracts\CacheInterface;

class SessionStore
{
    public function __construct(
        private CacheInterface $cache,
    ) {}

    public function getSession(string $token): ?array
    {
        return $this->cache->get("session.$token");
    }

    public function saveSession(string $token, array $data): void
    {
        $this->cache->set("session.$token", $data, ttl: 1800);
    }
}

Documentation

Full usage, API reference, and examples: marko/cache-redis