Search by

marko / cache

markshust

Cache interfaces and infrastructure for Marko Framework

Package info

github.com/marko-php/marko-cache

Type:marko-module

pkg:composer/marko/cache

Statistics

Installs: 1 337

Dependents: 13

Suggesters: 5

Stars: 0

0.13.0 2026-11-01 13:10 UTC

README

Interfaces for caching --- defines how data is stored, retrieved, and expired, not how the backend works.

Installation

composer require marko/cache

Note: You typically install a driver package (like marko/cache-file) which requires this automatically.

Quick Example

use Marko\Cache\Contracts\CacheInterface;

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

    public function getProduct(int $id): Product
    {
        return $this->cache->remember(
            "product.$id",
            3600,
            fn (): Product => $this->repository->find($id),
        );
    }
}

Documentation

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