1<?php 2 3/** 4 * Device Detector - The Universal Device Detection library for parsing User Agents 5 * 6 * @link https://matomo.org 7 * 8 * @license http://www.gnu.org/licenses/lgpl.html LGPL v3 or later 9 */ 10 11declare(strict_types=1); 12 13namespace DeviceDetector\Cache; 14 15use Doctrine\Common\Cache\CacheProvider; 16 17class DoctrineBridge implements CacheInterface 18{ 19 /** 20 * @var CacheProvider 21 */ 22 private $cache; 23 24 /** 25 * @param CacheProvider $cache 26 */ 27 public function __construct(CacheProvider $cache) 28 { 29 $this->cache = $cache; 30 } 31 32 /** 33 * @inheritDoc 34 */ 35 public function fetch(string $id) 36 { 37 return $this->cache->fetch($id); 38 } 39 40 /** 41 * @inheritDoc 42 */ 43 public function contains(string $id): bool 44 { 45 return $this->cache->contains($id); 46 } 47 48 /** 49 * @inheritDoc 50 */ 51 public function save(string $id, $data, int $lifeTime = 0): bool 52 { 53 return $this->cache->save($id, $data, $lifeTime); 54 } 55 56 /** 57 * @inheritDoc 58 */ 59 public function delete(string $id): bool 60 { 61 return $this->cache->delete($id); 62 } 63 64 /** 65 * @inheritDoc 66 */ 67 public function flushAll(): bool 68 { 69 return $this->cache->flushAll(); 70 } 71} 72