Skip to content

Commit ae9bc0f

Browse files
committed
Update readme
1 parent eb3a8d2 commit ae9bc0f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ElasticSessionStore.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static function putMapping() {
4646
'updated' => ['type' => 'date'],
4747
'data' => ['type' => 'string', 'index' => 'no'],
4848
],
49-
'_ttl' => (!!$ttl ? ['enabled' => true, 'default' => $ttl? : '30m'] : ['enabled' => false])
49+
'_ttl' => ($ttl ? ['enabled' => true, 'default' => $ttl? : '30m'] : ['enabled' => false])
5050
]
5151
];
5252
$client->indices()->putMapping($mappingParams);
@@ -77,7 +77,7 @@ public function write($sessionId, $sessionData) {
7777
$updatedTs = Carbon::now()->toIso8601String();
7878
$createdTs = array_key_exists($sessionId, $this->_cache) ? $this->_cache[$sessionId]->created : $updatedTs;
7979
$ttl = $this->getTTL();
80-
static::create(['data' => $sessionData, 'created' => $createdTs, 'updated' => $updatedTs, '_ttl' => $ttl], $sessionId, ["api" => "index"]);
80+
static::create(['data' => $sessionData, 'created' => $createdTs, 'updated' => $updatedTs] + ($ttl ? ['_ttl' => $ttl] : []), $sessionId, ["api" => "index"]);
8181
}
8282

8383
public function destroy($sessionId) {
@@ -99,7 +99,7 @@ public function type() {
9999
protected function getTTL() {
100100
$ttl = config('session.lifetime', 30);
101101
$ttl.=$ttl ? 'm' : '';
102-
return $ttl;
102+
return !!$ttl ? $ttl : false;
103103
}
104104

105105
}

0 commit comments

Comments
 (0)