^^^ good point re serverInvalidate
.
It’d be like writing an onSessionEnd
handler that also calls applicationStop
. Semantically: it makes no sense. Does it?
Maybe instead of jumping forwards all the way to the solution, it might be helpful if you share what problem yer trying to solve, @Zackster.
Now that I think about it, I’m not sure the parallel between sessionInvalidate
and this suggested applicationInvalidate
really holds.
I think one needs to look at sessionInvalidate
in the context of sessionRotate
, and what the two functions are trying to do. They are about the association of a client user to a server session, and are about “experience personalisation and continuity”, and the ability to renew or end that continuity. There is no such parallel at application level I think. The application starts, but it has no “personality” or individuality after that.
That’s not to say the desire to end an application and its sessions is not valid: it definitely is. I just am not sure the mooted nomenclature / metaphor holds.
Might this be a variant in behaviour of applicationStop
? I’m generally loath to suggest boolean flag params, but might applicationStop(boolean stopSessions=false)
be reasonable here? Although its usage would be applicationStop()
and applicationStop(true)
. Without knowing already, what does true
mean here? Bleah. This is why boolean flag params are rubbish. A way around this would be to have a system constant END_SESSIONS
(the value of which would be true
), so one would use: applicationStop(END_SESSIONS)
. This is not idiomatic CFML though.
The alternative “clean code” approach would be to have a different function, but applicationAndItsSessionsStop
sounds rubbish.
Even if we were to “fix” CFML’s yoda-speak and have stopApplicationAndSessions
it’s still not great. And also breaks “sideways compat” with applicationStop
anyhow.
Back to applicationInvalidate
. If we were to add that, Lucee’s CFML would have applicationStop
and applicationInvalidate
. The difference being one ends sessions too, the other doesn’t. For someone not part in this conversation, how does one tell which does which, without checking? Nothing about either name suggests any difference in behaviour regarding sessions.
I think this is one of those “naming is hard” things.
And I’m sorry I’ve only been able to go “I don’t like any of these”, without coming up with a good alternative 