views:

188

answers:

2

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?

+2  A: 

I suppose you are looking for Purge Interval setting, which is configured in CF Administrator at Server Settings > Client Variables page. Default interval is 1 hour 7 min.

EDIT: This setting value is not exactly what you need. I'm sorry, see my comment about purging -- think it is more accurate.

Sergii
@Sergii - That's interesting... that might be what I'm looking for. But if I set the interval to 72 hours, and a variable is set on the 71st hour, will it be purged 1 hour later? Or is the purge interval "since the last access"?
Joshua Carmody
See Andreas answer, first paragraph. If you are using the database or registry for storing client variables, you can set up it's own purge setting ("Purge data for clients that remain unvisited for 3 days" -- for your 72 hrs, right), which means "Enable this option if you want ColdFusion to periodically purge client data that has not been accessed in the specified number of days." Think this answers your question. Sorry, I can't tell for 100% sure because not used client scope instead of session.
Sergii
+3  A: 

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).

Andreas Schuldhaus