1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* |
5
|
|
|
* This file is part of Phpfastcache. |
6
|
|
|
* |
7
|
|
|
* @license MIT License (MIT) |
8
|
|
|
* |
9
|
|
|
* For full copyright and license information, please see the docs/CREDITS.txt and LICENCE files. |
10
|
|
|
* |
11
|
|
|
* @author Georges.L (Geolim4) <[email protected]> |
12
|
|
|
* @author Contributors https://github.com/PHPSocialNetwork/phpfastcache/graphs/contributors |
13
|
|
|
*/ |
14
|
|
|
|
15
|
|
|
declare(strict_types=1); |
16
|
|
|
|
17
|
|
|
namespace Phpfastcache\Drivers\Devnull; |
18
|
|
|
|
19
|
|
|
use Phpfastcache\Core\Pool\ExtendedCacheItemPoolInterface; |
20
|
|
|
use Phpfastcache\Core\Pool\TaggableCacheItemPoolTrait; |
21
|
|
|
use Phpfastcache\Entities\DriverStatistic; |
22
|
|
|
use Phpfastcache\Exceptions\PhpfastcacheInvalidArgumentException; |
23
|
|
|
use Psr\Cache\CacheItemInterface; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class Driver |
27
|
|
|
* @method Config getConfig() |
28
|
|
|
*/ |
29
|
|
|
class Driver implements ExtendedCacheItemPoolInterface |
30
|
|
|
{ |
31
|
|
|
use TaggableCacheItemPoolTrait; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @return bool |
35
|
|
|
*/ |
36
|
|
|
public function driverCheck(): bool |
37
|
|
|
{ |
38
|
|
|
return true; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return DriverStatistic |
43
|
|
|
*/ |
44
|
|
|
public function getStats(): DriverStatistic |
45
|
|
|
{ |
46
|
|
|
$stat = new DriverStatistic(); |
47
|
|
|
$stat->setInfo('[Devnull] A void info string') |
48
|
|
|
->setSize(0) |
49
|
|
|
->setData(implode(', ', array_keys($this->itemInstances))) |
50
|
|
|
->setRawData(null); |
51
|
|
|
|
52
|
|
|
return $stat; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @param CacheItemInterface $item |
57
|
|
|
* @return mixed |
58
|
|
|
* @throws PhpfastcacheInvalidArgumentException |
59
|
|
|
*/ |
60
|
|
|
protected function driverWrite(CacheItemInterface $item): bool |
61
|
|
|
{ |
62
|
|
|
$this->assertCacheItemType($item, Item::class); |
63
|
|
|
|
64
|
|
|
return true; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @param CacheItemInterface $item |
69
|
|
|
* @return null |
70
|
|
|
*/ |
71
|
|
|
protected function driverRead(CacheItemInterface $item): ?array |
|
|
|
|
72
|
|
|
{ |
73
|
|
|
return null; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @param CacheItemInterface $item |
78
|
|
|
* @return bool |
79
|
|
|
* @throws PhpfastcacheInvalidArgumentException |
80
|
|
|
*/ |
81
|
|
|
protected function driverDelete(CacheItemInterface $item): bool |
82
|
|
|
{ |
83
|
|
|
$this->assertCacheItemType($item, Item::class); |
84
|
|
|
|
85
|
|
|
return true; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @return bool |
90
|
|
|
*/ |
91
|
|
|
protected function driverClear(): bool |
92
|
|
|
{ |
93
|
|
|
return true; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return bool |
98
|
|
|
*/ |
99
|
|
|
protected function driverConnect(): bool |
100
|
|
|
{ |
101
|
|
|
return true; |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.