Thanks Cameron and Dean. The structDelete was what I was looking for!
But Cameron, you made me think of another question when you mentioned
calling init() on your user object. When do you create it? At the start of a
session?
Thanks again,
Clarke
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Cameron
Childress
Sent: Wednesday, July 02, 2008 6:44 PM
To: [email protected]
Subject: Re: [ACFUG Discuss] Destroy An Object
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
-------------------------------------------------------------