You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
to migrate between old and new save handlers without losing session data.
96
97
97
-
It can be used to support the following workflow:
98
+
This is the recommended migration workflow:
98
99
99
-
* Switch to the migrating handler, with your new handler as the write-only one. The old handler behaves as usual and sessions get written to the new one.
100
-
* After your session gc period, verify the data in the new handler
101
-
* Update the migrating handler to use the old handler as the write-only one, so the sessions will now be read from the new handler. This step allows easier rollbacks.
102
-
* After verifying that the sessions in your app are working, switch from the migrating handler to the new handler.
100
+
#. Switch to the migrating handler, with your new handler as the write-only one.
101
+
The old handler behaves as usual and sessions get written to the new one::
103
102
104
-
Example usage::
105
-
106
-
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MigratingSessionHandler;
107
-
108
-
$oldSessionStorage = ...;
109
-
$newSessionStorage = ...;
103
+
$sessionStorage = new MigratingSessionHandler($oldSessionStorage, $newSessionStorage);
110
104
111
-
// First step, for the the garbage collection period so we get all sessions in the new storage handler
112
-
$sessionStorage = new MigratingSessionHandler($oldSessionStorage, $newSessionStorage);
105
+
#. After your session gc period, verify that the data in the new handler is correct.
106
+
#. Update the migrating handler to use the old handler as the write-only one, so
107
+
the sessions will now be read from the new handler. This step allows easier rollbacks::
113
108
114
-
// Second step, just while we verify that the new session storage handler works as expected
115
-
$sessionStorage = new MigratingSessionHandler($newSessionStorage, $oldSessionStorage);
109
+
$sessionStorage = new MigratingSessionHandler($newSessionStorage, $oldSessionStorage);
116
110
117
-
// Final step - switching to the new storage handler!
111
+
#. After verifying that the sessions in your application are working, switch
0 commit comments