honklegion/psr16storage

Nette PSR16 storage adapter

Maintainers

Package info

github.com/HonkLegion/Psr16Storage

pkg:composer/honklegion/psr16storage

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-03-06 21:53 UTC

This package is auto-updated.

Last update: 2026-03-06 21:57:36 UTC


README

CI Coverage Status Latest Stable Version Total Downloads License

Nette cache Storage adapter backed by a PSR-16 cache implementation.

Installation

composer require honklegion/psr16storage

Requirements

  • PHP >=8.2 <8.6
  • nette/caching ^3.2
  • psr/simple-cache ^1.0|^3.0

Usage

Use any PSR-16 cache and wrap it with Psr16Storage.

<?php

declare(strict_types=1);

use HonkLegion\Psr16Storage\Psr16Storage;
use Nette\Caching\Cache;

/** @var \Psr\SimpleCache\CacheInterface $psr16 */
$storage = new Psr16Storage($psr16);
$cache = new Cache($storage);

$cache->save('key', 'value', [
    Cache::Expire => time() + 300,
]);

$value = $cache->load('key');

Optional max TTL forwarded to PSR-16 backend:

$storage = new Psr16Storage($psr16, 3600); // max 1 hour

Notes and Limitations

  • Cache::Items dependency is not supported and throws Nette\NotSupportedException.
  • Cache::Tags and Cache::Priority are not supported and throw Nette\InvalidStateException.
  • Callback dependencies are supported and invalid entries are removed.
  • Sliding expiration is supported.

Development

composer test
composer phpcs
composer phpstan

CI runs on PHP 8.2, 8.3, 8.4, and 8.5.