-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Persisten session after server restart #704
Comments
It's the first opened issue... Redis should work, it works on me if you have any issues please contact on the chat, we may find what's wrong with your setup. However, you can use the file storage session database, example: https://github.com/kataras/iris/blob/master/_examples/sessions/database/file/main.go |
I made it work with the file storage from the example above. One thing I noticed is that on line 108 inside this file "github.com/kataras/iris/sessions/sessiondb/file", that there is no error checking for ioutil.WriteFile, in case you don't have the right permissions to create a file. @kataras Is the file session storage slower than default sessions? |
@speedwheel thanks for the info, it has been fixed. Yes anything else than memory storage is slower. This session manager uses always the memory (high performance but may need more RAM) and if you want persistence then you attach a session database (like file storage and redis), simple and efficient. We did use this session manager(the iris one which I authored) at production, but nothing stops you to use an external one, remember? Iris is compatible with everything. |
I understand, one last question: Is sess.Start(ctx).Get() slower using the file session storage? I am not really sure how it works, but I am thinking the file session is than dumped in the memory, so it should be the same speed? |
I'll try to explain you the flow:
Using everything else except memory is slower than memory but database is fetched once at each session and its updated on every I hope that your questions are being answered. |
Thanks for the answer, it works similar like I was thinking and I consider that Iris Sessions are suitable for my project. |
As @kataras said, session Get only fetch values from database once,but if the values in database updated by other server node,the session in memory will not update! This behavior will cause memory session in many server nodes inconsistent! for example, issue #885 . |
…d) as requested kataras#704 (comment) Former-commit-id: 6a96da0bde5ae8d999fc9c1e6af49db2a893a6d5
Hello, glad to see there is a lot of activity and more user are taking part to make Iris better and better.
Now, I am not really sure how to implement this myself, but what would be the easiest way to make a session persistent after server restart? I tried the example with Redis, but the session was destroyed after server restart.
Any ideas how to achieve this?
The text was updated successfully, but these errors were encountered: