Skip to content

Commit 924f21e

Browse files
committed
Add attribute to session handler
1 parent f876a35 commit 924f21e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Session/MongoDbSessionHandler.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use MongoDB\BSON\Document;
1717
use MongoDB\BSON\UTCDateTime;
1818
use MongoDB\Collection;
19+
use Override;
1920

2021
use function tap;
2122
use function time;
@@ -32,20 +33,23 @@ public function close(): bool
3233
return true;
3334
}
3435

36+
#[Override]
3537
public function gc($lifetime): int
3638
{
3739
$result = $this->getCollection()->deleteMany(['last_activity' => ['$lt' => $this->getUTCDateTime(-$lifetime)]]);
3840

3941
return $result->getDeletedCount() ?? 0;
4042
}
4143

44+
#[Override]
4245
public function destroy($sessionId): bool
4346
{
4447
$this->getCollection()->deleteOne(['_id' => (string) $sessionId]);
4548

4649
return true;
4750
}
4851

52+
#[Override]
4953
public function read($sessionId): string|false
5054
{
5155
$result = $this->getCollection()->findOne(
@@ -63,6 +67,7 @@ public function read($sessionId): string|false
6367
return false;
6468
}
6569

70+
#[Override]
6671
public function write($sessionId, $data): bool
6772
{
6873
$payload = $this->getDefaultPayload($data);
@@ -87,6 +92,7 @@ public function createTTLIndex(): void
8792
);
8893
}
8994

95+
#[Override]
9096
protected function getDefaultPayload($data): array
9197
{
9298
$payload = [

0 commit comments

Comments
 (0)