Comments (7)
I'll try to explain you the flow:
- .Start -> if session database attached then load from that storage and save to the memory, otherwise load from memory. The load from database is done once on the initialize of each session.
- .Get (important) -> load from memory, if database attached then it already loaded the values from database on the .Start action, so it will retrieve the data from the memory (fast)
- .Set -> set to the memory, if database attached then update the storage
- .Delete -> clear from memory, if database attached then update the storage
- .Destroy -> destroy from memory and client cookie, if database attached then update the storage with empty values, empty values means delete the storage with that specific session id.
Using everything else except memory is slower than memory but database is fetched once at each session and its updated on every Set, Delete, Destroy
at call-time (all other external sessions managers out there work different than Iris one as far as I know, you may find them more suited to your application, it depends).
I hope that your questions are being answered.
from iris.
Thanks for the answer, it works similar like I was thinking and I consider that Iris Sessions are suitable for my project.
from iris.
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
from iris.
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?
from iris.
@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.
from iris.
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?
from iris.
.Get (important) -> load from memory, if database attached then it already loaded the values from database on the .Start action, so it will retrieve the data from the memory (fast)
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 .
from iris.
Related Issues (20)
- [BUG] The cache entry has not been truly deleted after expiration HOT 5
- [BUG] Pluralization uses yml for template configuration, uses ctx.Tr method for rendering, returns no data HOT 1
- [BUG] HOT 3
- [BUG] may be an out-of-boundary bug as a result of lack of necessary argument checks HOT 1
- [BUG] Process hang HOT 1
- [FEATURE REQUEST] redis sentinel support
- [FEATURE REQUEST] Support log/slog HOT 4
- [QUESTION] iris v12.2.0 app.ContextPool.Attach not found HOT 1
- [HELP] How to dynamically start http services on multiple ports? HOT 1
- [HELP] How to proactively send websocket messages to the client in an MVC structure?
- [HELP] Multiple event when using native message
- Iris gRPC wrapper breaking HOT 1
- getBuiltinFuncs problem
- [BUG] template part Unable to load HOT 1
- [BUG] I used goroutine to affect the later HTTP before the service startup HOT 2
- [BUG] validation of binding is not effective
- [QUESTION] The session configuration provided by the iris framework is limited
- [FEATURE REQUEST] Get the data in the session through the session id
- [BUG] ctx.RemoveCookie need more special attribute(`domain` and `path`) value to remove cookies HOT 3
- slog is not in GOROOT HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iris.