psx / cache
PSR-6 and PSR-16 implementation using the doctrine cache system
Fund package maintenance!
chriskapp
Patreon
www.paypal.me/fusioapi
Installs: 157 267
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 2
Open Issues: 3
Requires
- php: >=7.0
- doctrine/cache: ^1.6
- psr/cache: ^1.0
- psr/simple-cache: ^1.0
Requires (Dev)
- phpunit/phpunit: ^6.0
Provides
This package is auto-updated.
Last update: 2024-11-05 02:43:25 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); }