开发者

How can I timeout Client-scoped variables in Coldfusion?

开发者 https://www.devze.com 2022-12-24 04:46 出处:网络
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 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 开发者_Go百科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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号