Skip to content

3.1.0

Choose a tag to compare

@spryker-bot spryker-bot released this 13 Mar 11:23
· 330 commits to master since this release

Included commits: 3.0.0...3.1.0

Improvements

Introduced a new Redis session-handler that supports session locking.

Migration

In order add support for session locking with Redis, a couple of modifications have to be applied to project implementation.

The following lines have to be added to the switch statement in SessionServiceProvider::setSessionStorageHandler to enable registering the new session handler in Yves:

protected function setSessionStorageHandler(Application $app, $saveHandler)
{
        // ...
        
        switch ($saveHandler) {
            case SessionConstants::SESSION_HANDLER_REDIS_LOCKING:
                $redisSessionHandler = $sessionHelper->createRedisLockingSessionHandler($this->getSavePath($saveHandler));
                $app['session.storage.handler'] = $app->share(function () use ($redisSessionHandler) {
                    return $redisSessionHandler;
                });
                break;

                // ...
        }
}

The switch statement in SessionServiceProvider::getSavePath() has to get extended as well to provide connection details for the new session handler. (The connection details are not different from the ones that are used with the existing Redis session handler.)

protected function getSavePath($saveHandler)
{
      // ...
     
      switch ($saveHandler) {
            case SessionConstants::SESSION_HANDLER_REDIS:
            case SessionConstants::SESSION_HANDLER_REDIS_LOCKING:
                $path = $this->getConnectionString();
                break;

            // ...
       }

      // ....

       return $path;
}

Finally, to use the new session handler, the configuration for SessionConstants::YVES_SESSION_SAVE_HANDLER to SessionConstants::SESSION_HANDLER_REDIS_LOCKING. This will enable locked session handling with Redis for Yves