PSR-6 (Caching Interface) (opens new window) adapter for Nette Caching (opens new window)

# Content

# Setup

Install package

composer require contributte/psr6-caching
1

Register extension

extensions:
	psr6: Contributte\Psr6\DI\Psr6CachingExtension
1
2

# Usage

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');
	}

}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

Rest is in psr-6 documentation (opens new window)