Skip to content
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

Add interfaces to initialise session ID #38

Open
wants to merge 2 commits into
base: develop
from

Conversation

@kynx
Copy link

commented Aug 18, 2019

This PR adds two interfaces:

  • InitializeSessionIdInterface adds an initialiseId() method to sessions. This returns the session ID, creating a new ID if not present or regenerating an existing one
  • InitializePersistenceIdInterface adds an initialiseId() method to persistence. This returns a new Session with the ID generated / regenerated if required.

LazySession can now initialise the ID if the persistence supports it.

I outlined a couple of use cases on the forum. Though when I wrote that I was thinking the session would also needed to be started. I've since realised that isn't required.

@kynx kynx changed the base branch from master to develop Aug 18, 2019

@boesing

This comment has been minimized.

Copy link
Member

commented Aug 19, 2019

Wondering if @Ocramius https://github.com/psr7-sessions/storageless would be better for problems like yours.

Maybe you have a look on that project and re-think if you still need these changes in here.

@kynx

This comment has been minimized.

Copy link
Author

commented Aug 19, 2019

Yeah, aware of that. Doesn’t really fit for the current project.

Curious though, given that you can getId() on an existing session, what’s the reason not to get the id of a new / regenerated one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.