PSR-6 (Caching Interface) adapter for Nette Caching
Install package
composer require contributte/psr6-caching
Register extension
extensions:
psr6: Contributte\Psr6\DI\Psr6CachingExtension
Get ICachePoolFactory
from DI
use Contributte\Psr6\ICachePoolFactory;
class MyClass
{
/** @var ICachePoolFactory */
private $cachePoolFactory;
public function __construct(ICachePoolFactory $cachePoolFactory) {
$this->cachePoolFactory = $cachePoolFactory;
}
private function doSomething(): void
{
$cachePool = $this->cachePoolFactory->create('namespace');
}
}
Rest is in psr-6 documentation