-
-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide customizable session regeneration behavior #61
Comments
@weierophinney Can I get a response please? |
@Eliasyoussef47 |
@froschdesign |
The same question like in #60: What is the concrete use-case for this? |
It's currently needed to solve an issue where session loss occurs as a result of an unstable network or request cancellation. Although, I realized that it's possible to use a custom |
Feature Request
Summary
I would like to be able to customize the behavior of the method
CacheSessionPersistence::regenerateSession
:mezzio-session-cache/src/CacheSessionPersistence.php
Lines 155 to 168 in 83b5533
Control whether or not the old session is deleted
Currently, the method
regenerateSession
always deletes the old session. I would like to be able to control this behavior.Firstly, it might be nice to add a parameter to this method to make it match the PHP function session_regenerate_id. The extra boolean parameter will determine whether or not the old session will be deleted before generating the new ID.
Alternatively (or it might be even better to do both), I would like to see a boolean field that determines whether or not the old session will always be deleted before generating the new ID. The value of this field can be set in the constructor of
CacheSessionPersistence
.Customize the behavior of
CacheSessionPersistence::regenerateSession
I would like to partially or completely change the behavior of
regenerateSession
.This can be done by calling callback function(s) provided by the user/calling code. The callback can be called before checking if the item exists in the cache.
Alternatively (and probably better), the
regenerateSession
method can become protected to allow the inheriting code to fully customize the implementation.If an RFC is needed, I will be able to supply one. I'm also open to opening a pull request to implement this.
The text was updated successfully, but these errors were encountered: