60 lines
1.5 KiB
PHP
60 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
*
|
|
* This file is part of phpFastCache.
|
|
*
|
|
* @license MIT License (MIT)
|
|
*
|
|
* For full copyright and license information, please see the docs/CREDITS.txt file.
|
|
*
|
|
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> https://www.phpfastcache.com
|
|
* @author Georges.L (Geolim4) <contact@geolim4.com>
|
|
*
|
|
*/
|
|
declare(strict_types=1);
|
|
|
|
namespace Phpfastcache\Drivers\Files;
|
|
|
|
use Phpfastcache\Core\Item\{ExtendedCacheItemInterface, ItemBaseTrait};
|
|
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface;
|
|
use Phpfastcache\Drivers\Files\Driver as FilesDriver;
|
|
use Phpfastcache\Exceptions\{PhpfastcacheInvalidArgumentException};
|
|
|
|
/**
|
|
* Class Item
|
|
* @package phpFastCache\Drivers\Files
|
|
*/
|
|
class Item implements ExtendedCacheItemInterface
|
|
{
|
|
use ItemBaseTrait {
|
|
ItemBaseTrait::__construct as __BaseConstruct;
|
|
}
|
|
|
|
/**
|
|
* Item constructor.
|
|
* @param Driver $driver
|
|
* @param $key
|
|
* @throws PhpfastcacheInvalidArgumentException
|
|
*/
|
|
public function __construct(FilesDriver $driver, $key)
|
|
{
|
|
$this->__BaseConstruct($driver, $key);
|
|
}
|
|
|
|
/**
|
|
* @param ExtendedCacheItemPoolInterface $driver
|
|
* @return static
|
|
* @throws PhpfastcacheInvalidArgumentException
|
|
*/
|
|
public function setDriver(ExtendedCacheItemPoolInterface $driver)
|
|
{
|
|
if ($driver instanceof FilesDriver) {
|
|
$this->driver = $driver;
|
|
|
|
return $this;
|
|
}
|
|
|
|
throw new PhpfastcacheInvalidArgumentException('Invalid driver instance');
|
|
}
|
|
} |