-
Notifications
You must be signed in to change notification settings - Fork 111
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
[requesting how to proceed] saving on start #12
Comments
Great, I will look at implementing API for that. |
Hi, In my latest commit: I did introduce a new method/function: This works the same as session.start, but it will not set up a cookie or check if it needs to be reneved. So you can check if session is present like this: local session, present = session.open()
if present then
ngx.print("session was present")
else
ngx.pring("no session was present")
end
-- You can also check session.present and it works the same:
local session = session.open()
if session.present then
ngx.print("session was present")
else
ngx.pring("no session was present")
end Can you please check that this fixes your issue. I may then make a new release. So, to create a session you can use one of these constructors:
So you can: local s = session.new()
s:open()
s:start()
-- which is same as:
local s = session.open()
s:start()
-- which is same as:
local s = session.start() See also a new documentation on readme. There are new fields as well, like: session.present
session.opened
session.started
session.destroyed Regards |
Hi. Thanks for the quick input and work, this is exactly what I was hoping for! ... Yet we removed sessions via cookie from the project so we're not using resty-session anymore, so it's not trivial for me to test it at the moment. However as soon as I can I'll try to rollback to a previous version to test it and report to you. Best regards, |
I consider this to be fixed now. Please reopen if you still get problems with it. |
Hi.
I've been using your library and I've noticed that when I do session.start() for the first time it will set a Set-Cookie in header, because it calls method regenerate. This is not desired when I just want to read and check if session exists. I could do this by first checking if a cookie named session is present, but I think it would be best to delegate this to resty-session, especially since we could change the name of the key and so on, so for now I removed the save instruct on regenerate (since I don't use it directly and I end up calling save after setting some data anyway). What do you think is the best way to proceed?
Thanks for the awesome library btw.
The text was updated successfully, but these errors were encountered: