How is structClear(session) different than sessionInvalidate()?

coldfusion

Solution

According to Mister Dai, who has backported the SessionInvalidate function to previous versions, it performs more than just calling `StructClear`, and also calls `onSessionEnd` before this, and `coldfusion.runtime.sessionTracker.cleanup` afterwards.

Further details at: https://misterdai.yougeezer.co.uk/blog/project/2012-03-12/

Something that _neither_ of these methods do, which is worth being aware of, is that they do not invalidate the session if CF is set to "Use J2EE session variables" (since this is controlled by the underlying servlet engine, not by CF)

Problem

This might be a silly question but I'd like to know what exactly is the difference between `structClear(session)` and the `sessionInvalidate()` function added in ColdFusion 10?

Original source