Skip to content

Commit e10acc4

Browse files
committed
Add attribute to session handler
1 parent 45b684f commit e10acc4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Session/MongoDbSessionHandler.php

Lines changed: 11 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,26 @@ public function close(): bool
3233
return true;
3334
}
3435

36+
/** @inheritdoc */
37+
#[Override]
3538
public function gc($lifetime): int
3639
{
3740
$result = $this->getCollection()->deleteMany(['last_activity' => ['$lt' => $this->getUTCDateTime(-$lifetime)]]);
3841

3942
return $result->getDeletedCount() ?? 0;
4043
}
4144

45+
/** @inheritdoc */
46+
#[Override]
4247
public function destroy($sessionId): bool
4348
{
4449
$this->getCollection()->deleteOne(['_id' => (string) $sessionId]);
4550

4651
return true;
4752
}
4853

54+
/** @inheritdoc */
55+
#[Override]
4956
public function read($sessionId): string|false
5057
{
5158
$result = $this->getCollection()->findOne(
@@ -63,6 +70,8 @@ public function read($sessionId): string|false
6370
return false;
6471
}
6572

73+
/** inheritdoc */
74+
#[Override]
6675
public function write($sessionId, $data): bool
6776
{
6877
$payload = $this->getDefaultPayload($data);
@@ -87,6 +96,8 @@ public function createTTLIndex(): void
8796
);
8897
}
8998

99+
/** @inheritdoc */
100+
#[Override]
90101
protected function getDefaultPayload($data): array
91102
{
92103
$payload = [

0 commit comments

Comments
 (0)