PHP code example of oops / cache-factory

1. Go to this page and download the library: Download oops/cache-factory library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oops / cache-factory example snippets


class CachedFoo
{
	private $cache;

	public function __construct(Nette\Caching\IStorage $cacheStorage)
	{
		$this->cache = new Nette\Caching\Cache($cacheStorage, 'namespace');
	}
}

class CachedFoo
{
	private $cache;

	public function __construct(Oops\CacheFactory\Caching\CacheFactory $cacheFactory)
	{
		$this->cache = $cacheFactory->create('namespace');
	}
}

$cacheFactory->create('namespace', new Nette\Caching\Storages\DevNullStorage());