Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I timeout Client-scoped variables in Coldfusion?

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?

like image 674
Joshua Carmody Avatar asked Mar 24 '10 16:03

Joshua Carmody


People also ask

How do you delete a session in ColdFusion?

The variables SessionID, CFID, and CFTOKEN are set once by ColdFusion instead of on every request. When you use theStructClear(Session) function, it will clear the SessionID, CFID, and CFTOKEN variables because they are set once and they are in a Struct.

What is application CFC?

The Application. cfc file defines application-wide settings and variables, and application event handlers: Application-wide settings and variables include page processing settings, default variables, data sources, style settings, and other application-level constants.


1 Answers

Depending whether your are using a datasource or registry as a Client Store you have to set the "Purge data for clients that remain unvisited for 90 days to 3 days (=72 hours) on the

ColdFusion Administrator => Client Variables => Registry

or

Client Variables => NameOfDatabase Page.

If Client Variables are stored as cookies, then you have to adjust the expires period, when setting the cookie.

The Purge Interval on the Client Variables page only controls how often ColdFusion executes a purge operation on your client stores (= seeks for expired Client Variables in order to delete them).

like image 72
Andreas Schuldhaus Avatar answered Sep 24 '22 10:09

Andreas Schuldhaus