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

read-only non-locking session #17

Open
rocksfrow opened this issue Jan 22, 2015 · 3 comments
Open

read-only non-locking session #17

rocksfrow opened this issue Jan 22, 2015 · 3 comments

Comments

@rocksfrow
Copy link
Contributor

If #14 ends up a no-go, I was thinking it might be interesting to add a read-only mode which would allow applications to access locked sessions, but prevent writes.

For scenarios where a bunch of separate sections of a site are loading via ajax (and not writing to the session, only reading), this would enable you to have true asynchronous requests to the same session.

This implementation would of course still require a lock for write access.

Currently the read() method is requiring a lock.

@nicktacular
Copy link
Owner

This is a good idea, too. Probably a lot simpler than #14 and in a majority of cases might be what you want anyway.

@rocksfrow
Copy link
Contributor Author

And makes me less nervous! Haha
On Jan 22, 2015 1:22 PM, "Nick Ilyin" notifications@github.com wrote:

This is a good idea, too. Probably a lot simpler than #14
#14 and in a
majority of cases might be what you want anyway.


Reply to this email directly or view it on GitHub
#17 (comment)
.

@nicktacular
Copy link
Owner

Having thought about this more, I think this is a must have. A few things need to be done here:

  • Upon calling read(), MongoSession needs to de-serialize the data using session_decode method to reference a local copy.
  • Introduce a get($key) method which will allow access to that reference without regard for locking since the assumption here is that it will be immutable.
  • Ensure that for referenced objects, clone is called on them so that there's no confusion of immutability.

How does that sound?

FYI see #16

@nicktacular nicktacular added this to the Read-only sessions milestone Feb 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants