Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Allow changing the redis session TTL at runtime
  • Loading branch information
Seldaek authored Nov 30, 2021
commit c67a4601ace3c75b81872769948d32e4dfba0429
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(\Redis|\RedisArray|\RedisCluster|\Predis\ClientInter

$this->redis = $redis;
$this->prefix = $options['prefix'] ?? 'sf_s';
$this->ttl = $options['ttl'] ?? null;
$this->setTtl($options['ttl'] ?? null);
}

/**
Expand Down Expand Up @@ -110,4 +110,9 @@ public function updateTimestamp(string $sessionId, string $data): bool
{
return $this->redis->expire($this->prefix.$sessionId, (int) ($this->ttl ?? ini_get('session.gc_maxlifetime')));
}

public function setTtl(?int $ttl): void
{
$this->ttl = $ttl;
}
}