|[jetty-dev] Session Management with Redis|
I want to use Redis as a backing for my sessions. I’ve seen https://github.com/Ovea/jetty-session-redis, but the five years since any commit doesn’t inspire much confidence. I’ve also seen https://dev.eclipse.org/mhonarc/lists/jetty-dev/msg02086.html, but was unable to find the fruits of Denis’ labour.
So I’m currently making a NoSqlSessionManager extension based on Redis. For this I’m looking at the Mongo implementation and trying to stay close to it. Doing that I struck some code I don’t understand. Hopefully somebody here can enlighten me?
In org.eclipse.jetty.nosql.mongodb.MongoSessionManager.refresh(NoSqlSession, Object), which as I understand exists to update a session in memory from a session on disk, session.doPutOrRemove(attr,value) is called (l. 406). If the manager’s savePeriod is -2, that results in a org.eclipse.jetty.nosql.NoSqlSession.save(boolean), which is used to update a session on disk from memory. This does not look right to me, but I might (very well) be mistaken. Any clues?
A little further on in the same method (l. 420) this sequence is called:
I think the second call is equivalent to session.unbindValue(str, session.getAttribute(str));, but I’m not sure that that is what the authors meant. Can I do that or should it be:
Object o = session.getAttribute(str);
session.doPutOrRemove(str,null); // might also result in a save
Any help is appreciated,
Back to the top