marko/cache-file

File-based cache driver for Marko Framework

Maintainers

Package info

github.com/marko-php/marko-cache-file

Type:marko-module

pkg:composer/marko/cache-file

Statistics

Installs: 0

Dependents: 0

Suggesters: 1

Stars: 0

0.0.1 2026-03-25 17:53 UTC

This package is auto-updated.

Last update: 2026-03-25 21:07:25 UTC


README

File-based cache driver — persists cached data to disk with automatic expiration and atomic writes.

Installation

composer require marko/cache-file

Quick Example

use Marko\Cache\Contracts\CacheInterface;

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

    public function getAll(): array
    {
        if ($this->cache->has('settings.all')) {
            return $this->cache->get('settings.all');
        }

        $settings = $this->loadFromDatabase();
        $this->cache->set('settings.all', $settings, ttl: 7200);

        return $settings;
    }
}

Documentation

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