psx/cache

PSR-6 and PSR-16 implementation using the doctrine cache system

Maintainers

👁 chriskapp

Package info

github.com/apioo/psx-cache

Homepage

pkg:composer/psx/cache

Statistics

Installs: 170 723

Dependents: 1

Suggesters: 0

Stars: 2

Open Issues: 3

v1.0.2 2018-12-16 20:14 UTC

Requires

Requires (Dev)

Suggests

None

Conflicts

None

Replaces

None

Apache-2.0 db251e891d553b5fb633c5f2535a36bfcdfa52cf

cachedoctrinepsr-6psr-16

This package is auto-updated.

Last update: 2026-06-05 06:27:30 UTC


README

About

PSR-6 and PSR-16 implementation using the doctrine cache system.

Usage

PSR-6

<?php

$pool = new PSX\Cache\Pool(new Doctrine\Common\Cache\FilesystemCache());
$item = $pool->getItem('foo');

if (!$item->isHit()) {
 $value = doComplexTask();

 $item->set($value);
 $item->expiresAfter(3600);

 $pool->save($item);
} else {
 $value = $item->get();
}

PSR-16

<?php

$cache = new PSX\Cache\SimpleCache(new Doctrine\Common\Cache\FilesystemCache());
$value = $cache->get('foo');

if ($value === null) {
 $value = doComplexTask();

 $cache->set('foo', $value, 3600);
}