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
LaravelCache.php
53 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\Illuminate\Support\Facades\Cache; |
| 14 | /** @internal */ |
| 15 | class LaravelCache implements CacheInterface |
| 16 | { |
| 17 | /** |
| 18 | * @inheritDoc |
| 19 | */ |
| 20 | public function fetch(string $id) |
| 21 | { |
| 22 | return Cache::get($id); |
| 23 | } |
| 24 | /** |
| 25 | * @inheritDoc |
| 26 | */ |
| 27 | public function contains(string $id) : bool |
| 28 | { |
| 29 | return Cache::has($id); |
| 30 | } |
| 31 | /** |
| 32 | * @inheritDoc |
| 33 | */ |
| 34 | public function save(string $id, $data, int $lifeTime = 0) : bool |
| 35 | { |
| 36 | return Cache::put($id, $data, \func_num_args() < 3 ? null : $lifeTime); |
| 37 | } |
| 38 | /** |
| 39 | * @inheritDoc |
| 40 | */ |
| 41 | public function delete(string $id) : bool |
| 42 | { |
| 43 | return Cache::forget($id); |
| 44 | } |
| 45 | /** |
| 46 | * @inheritDoc |
| 47 | */ |
| 48 | public function flushAll() : bool |
| 49 | { |
| 50 | return Cache::flush(); |
| 51 | } |
| 52 | } |
| 53 |