https://www.phpfastcache.com * @author Georges.L (Geolim4) * */ declare(strict_types=1); namespace Phpfastcache\Drivers\Devfalse; use DateTime; use Phpfastcache\Core\Pool\{DriverBaseTrait, ExtendedCacheItemPoolInterface}; use Phpfastcache\Entities\DriverStatistic; use Phpfastcache\Exceptions\{PhpfastcacheInvalidArgumentException}; use Psr\Cache\CacheItemInterface; /** * Class Driver * @package phpFastCache\Drivers * @property Config $config Config object * @method Config getConfig() Return the config object */ class Driver implements ExtendedCacheItemPoolInterface { use DriverBaseTrait; /** * @return bool */ public function driverCheck(): bool { return true; } /** * @return DriverStatistic */ public function getStats(): DriverStatistic { $stat = new DriverStatistic(); $stat->setInfo('[Devfalse] A void info string') ->setSize(0) ->setData(implode(', ', array_keys($this->itemInstances))) ->setRawData(false); return $stat; } /** * @param CacheItemInterface $item * @return bool * @throws PhpfastcacheInvalidArgumentException */ protected function driverWrite(CacheItemInterface $item): bool { /** * Check for Cross-Driver type confusion */ if ($item instanceof Item) { return true; } throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); } /** * @param CacheItemInterface $item * @return array */ protected function driverRead(CacheItemInterface $item): array { return [ self::DRIVER_DATA_WRAPPER_INDEX => false, self::DRIVER_TAGS_WRAPPER_INDEX => [], self::DRIVER_EDATE_WRAPPER_INDEX => new DateTime(), ]; } /** * @param CacheItemInterface $item * @return bool * @throws PhpfastcacheInvalidArgumentException */ protected function driverDelete(CacheItemInterface $item): bool { /** * Check for Cross-Driver type confusion */ if ($item instanceof Item) { return true; } throw new PhpfastcacheInvalidArgumentException('Cross-Driver type confusion detected'); } /** * @return bool */ protected function driverClear(): bool { return true; } /******************** * * PSR-6 Extended Methods * *******************/ /** * @return bool */ protected function driverConnect(): bool { return true; } }