[Coldbox-4.1] Clearing bean properties

Is there an easy way to reset all properties of a session bean when a fwreinit is run?

Might have figured out what I need. I think structClear( session ) will do it. Any other suggestions?

If you want to completely expire the current user, that is one way to do it - albeit a brute force one. You could also call the onSessionEnd() method in Application.cfc. So in onRequestStart():

If(application.cbBootstrap.isfwreinit()) onSessionEnd();

You can define custom actions in that method to handle any additional variables that need to be cleared.

[Note: Typo assistance courtesy of iPhone]

Note this only works for YOUR session, not all sessions on the server. There is no supported programmatic way to clear all sessions which can be a bit of a pain if you’re rolling out a new version of your app that is incompatible with cached sessions objects. Best thing to do there is remove the server from your cluster and restart. Of course, if you’re just asking for testing on your box, then sure-- the structClear( session ) is fine.



ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com