And to add to Cam's response: When you replace the object with a new
instance, it is not destroyed immediately. However, you lose all
references to it and it may now be garbage collected. You should
never try to force the GC to run, the Java VM will handle it
automagically for you when needed.
-dhs
Dean H. Saxe, CISSP, CEH
[EMAIL PROTECTED]
"What difference does it make to the dead, the orphans, and the
homeless, whether the mad destruction is wrought under the name of
totalitarianism or the holy name of liberty and democracy? "
--Gandhi
On Jul 2, 2008, at 6:44 PM, Cameron Childress wrote:
On Wed, Jul 2, 2008 at 6:20 PM, Clarke Bishop <[EMAIL PROTECTED]
> wrote:
I have a user object that's stored in the session scope when a user
logs in.
When the session expires, the object gets garbage collected, right?
It's marked for GC, and eventually gets collected. Effectively as far
as the app's concerned it's gone immediately.
But, if I want to destroy the object, how do I do that? Maybe this
is not
something that's needed often as I couldn't find an answer via the
docs or
Google.
A few options...
To delete just that one item:
<cfset structDelete(session,'myUserObject') />
However, I usually have a "isLoggedIn" property on the user object
(with a default value of false) and do this:
<cfset session.myUserObject =
createObject('component','path.to.User').init() />
That way the user object still exists, but in recreating it you are
resetting all the props to their default values, with the significant
one here being isLoggedIn = false.
-Cameron
--
Cameron Childress
Sumo Consulting Inc
http://www.sumoc.com
---
cell: 678.637.5072
aim: cameroncf
email: [EMAIL PROTECTED]
-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------
-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------