2
2
3
3
namespace PhpOffice \PhpSpreadsheet \Collection \Memory ;
4
4
5
- use DateInterval ;
6
5
use Psr \SimpleCache \CacheInterface ;
7
6
8
7
/**
9
8
* This is the default implementation for in-memory cell collection.
10
9
*
11
- * Alternatives implementation should leverage off-memory, non-volatile storage
10
+ * Alternative implementation should leverage off-memory, non-volatile storage
12
11
* to reduce overall memory usage.
13
12
*/
14
13
class SimpleCache1 implements CacheInterface
@@ -25,14 +24,14 @@ public function clear(): bool
25
24
return true ;
26
25
}
27
26
28
- public function delete (string $ key ): bool
27
+ public function delete ($ key ): bool
29
28
{
30
29
unset($ this ->cache [$ key ]);
31
30
32
31
return true ;
33
32
}
34
33
35
- public function deleteMultiple (iterable $ keys ): bool
34
+ public function deleteMultiple ($ keys ): bool
36
35
{
37
36
foreach ($ keys as $ key ) {
38
37
$ this ->delete ($ key );
@@ -41,10 +40,7 @@ public function deleteMultiple(iterable $keys): bool
41
40
return true ;
42
41
}
43
42
44
- /**
45
- * @param mixed $default
46
- */
47
- public function get (string $ key , $ default = null ): mixed
43
+ public function get ($ key , $ default = null ): mixed
48
44
{
49
45
if ($ this ->has ($ key )) {
50
46
return $ this ->cache [$ key ];
@@ -53,10 +49,7 @@ public function get(string $key, $default = null): mixed
53
49
return $ default ;
54
50
}
55
51
56
- /**
57
- * @param mixed $default
58
- */
59
- public function getMultiple (iterable $ keys , $ default = null ): iterable
52
+ public function getMultiple ($ keys , $ default = null ): iterable
60
53
{
61
54
$ results = [];
62
55
foreach ($ keys as $ key ) {
@@ -66,26 +59,19 @@ public function getMultiple(iterable $keys, $default = null): iterable
66
59
return $ results ;
67
60
}
68
61
69
- public function has (string $ key ): bool
62
+ public function has ($ key ): bool
70
63
{
71
64
return array_key_exists ($ key , $ this ->cache );
72
65
}
73
66
74
- /**
75
- * @param mixed $value
76
- * @param null|DateInterval|int $ttl
77
- */
78
- public function set (string $ key , $ value , $ ttl = null ): bool
67
+ public function set ($ key , $ value , $ ttl = null ): bool
79
68
{
80
69
$ this ->cache [$ key ] = $ value ;
81
70
82
71
return true ;
83
72
}
84
73
85
- /**
86
- * @param null|DateInterval|int $ttl
87
- */
88
- public function setMultiple (iterable $ values , $ ttl = null ): bool
74
+ public function setMultiple ($ values , $ ttl = null ): bool
89
75
{
90
76
foreach ($ values as $ key => $ value ) {
91
77
$ this ->set ($ key , $ value );
0 commit comments