File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change 16
16
use MongoDB \BSON \Document ;
17
17
use MongoDB \BSON \UTCDateTime ;
18
18
use MongoDB \Collection ;
19
+ use Override ;
19
20
20
21
use function tap ;
21
22
use function time ;
@@ -32,20 +33,23 @@ public function close(): bool
32
33
return true ;
33
34
}
34
35
36
+ #[Override]
35
37
public function gc ($ lifetime ): int
36
38
{
37
39
$ result = $ this ->getCollection ()->deleteMany (['last_activity ' => ['$lt ' => $ this ->getUTCDateTime (-$ lifetime )]]);
38
40
39
41
return $ result ->getDeletedCount () ?? 0 ;
40
42
}
41
43
44
+ #[Override]
42
45
public function destroy ($ sessionId ): bool
43
46
{
44
47
$ this ->getCollection ()->deleteOne (['_id ' => (string ) $ sessionId ]);
45
48
46
49
return true ;
47
50
}
48
51
52
+ #[Override]
49
53
public function read ($ sessionId ): string |false
50
54
{
51
55
$ result = $ this ->getCollection ()->findOne (
@@ -63,6 +67,7 @@ public function read($sessionId): string|false
63
67
return false ;
64
68
}
65
69
70
+ #[Override]
66
71
public function write ($ sessionId , $ data ): bool
67
72
{
68
73
$ payload = $ this ->getDefaultPayload ($ data );
@@ -87,6 +92,7 @@ public function createTTLIndex(): void
87
92
);
88
93
}
89
94
95
+ #[Override]
90
96
protected function getDefaultPayload ($ data ): array
91
97
{
92
98
$ payload = [
You can’t perform that action at this time.
0 commit comments