CacheInterface.php
2 years ago
DoctrineBridge.php
2 years ago
LaravelCache.php
2 years ago
PSR16Bridge.php
2 years ago
PSR6Bridge.php
2 years ago
StaticCache.php
2 years ago
DoctrineBridge.php
64 lines
| 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 | declare (strict_types=1); |
| 11 | namespace IAWPSCOPED\DeviceDetector\Cache; |
| 12 | |
| 13 | use IAWPSCOPED\Doctrine\Common\Cache\CacheProvider; |
| 14 | /** @internal */ |
| 15 | class DoctrineBridge implements CacheInterface |
| 16 | { |
| 17 | /** |
| 18 | * @var CacheProvider |
| 19 | */ |
| 20 | private $cache; |
| 21 | /** |
| 22 | * @param CacheProvider $cache |
| 23 | */ |
| 24 | public function __construct(CacheProvider $cache) |
| 25 | { |
| 26 | $this->cache = $cache; |
| 27 | } |
| 28 | /** |
| 29 | * @inheritDoc |
| 30 | */ |
| 31 | public function fetch(string $id) |
| 32 | { |
| 33 | return $this->cache->fetch($id); |
| 34 | } |
| 35 | /** |
| 36 | * @inheritDoc |
| 37 | */ |
| 38 | public function contains(string $id) : bool |
| 39 | { |
| 40 | return $this->cache->contains($id); |
| 41 | } |
| 42 | /** |
| 43 | * @inheritDoc |
| 44 | */ |
| 45 | public function save(string $id, $data, int $lifeTime = 0) : bool |
| 46 | { |
| 47 | return $this->cache->save($id, $data, $lifeTime); |
| 48 | } |
| 49 | /** |
| 50 | * @inheritDoc |
| 51 | */ |
| 52 | public function delete(string $id) : bool |
| 53 | { |
| 54 | return $this->cache->delete($id); |
| 55 | } |
| 56 | /** |
| 57 | * @inheritDoc |
| 58 | */ |
| 59 | public function flushAll() : bool |
| 60 | { |
| 61 | return $this->cache->flushAll(); |
| 62 | } |
| 63 | } |
| 64 |