takman1 / phalcon-session-redis
Phalcon sessions on Redis without deprecations. php-redis >= 5, php >= 7, 4 > php-phalcon >= 3
Installs: 33 384
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=7.0
- ext-phalcon: ^3.0
- ext-redis: ^5.0
This package is auto-updated.
Last update: 2025-06-21 02:32:27 UTC
README
There's a deprecation warning when using php-redis extension with Phalcon.
The deprecation come from using setTimeout method instead of expire, in Phalcon Redis backend adapter class.
Deprecation conditions
- PHP >= 7
- PHP Redis >= 5
- 4 > Phalcon >= 3
Solution
The solution is to extend Base \Redis class and override setTimeout method. To do this we extend all Redis adapters chain nad make setTimeout call expire method.
Deprecated methods
\Redis::setTimeout()
Usage
use Takman1\Phalcon\Session\Adapter\Redis; $session = new Redis( [ "uniqueId" => "my-private-app", "host" => "localhost", "port" => 6379, "auth" => "foobared", "persistent" => false, "lifetime" => 3600, "prefix" => "my", "index" => 1, ] ); $session->start(); $session->set("var", "some-value"); echo $session->get("var");