How can I timeout Client-scoped variables in Coldfusion?

Posted by Joshua Carmody on Stack Overflow See other posts from Stack Overflow or by Joshua Carmody
Published on 2010-03-24T16:05:55Z Indexed on 2010/03/24 17:13 UTC
Read the original article Hit count: 245

I apologize if this is a "duh" question. It seems like the answer should be easily googleable, but I haven't found it yet.

I am working on a large Coldfusion application that stores a large amount of session/user data in the Client scope (ie <cfset Client.UserName = "JoshuaC"> ). I did not write this application, and I don't have the luxury of significantly refactoring it.

I've been given the task of setting the Client variables to time out after 72 hours. I'm not entirely sure how to do this. If I had written the application, I would have stored the variables in the Session scope, and then changed the sessiontimeout attribute of the CFAPPLICATION tag. As it is though, I'm not sure if that timeout affects the Client variables, or what their level of persistence is. The way the application works now, the Client variables never time out, and only clearing the user's cookies, or visiting a logout page which sets all the Client-scoped application variables to "", will clear the values.

Of course, I could create some kind of timestamp variable like Client.LastAccessDateTime, and put something in the Application.cfm to clear the client variables if that datetime is more than 72 hours prior to Now(). But there's got to be a better way, right?

© Stack Overflow or respective owner

Related posts about coldfusion

Related posts about scope