如何在 Coldfusion 中使客户端范围的变量超时?

发布于 2024-08-26 13:27:06 字数 543 浏览 2 评论 0原文

如果这是一个“呃”问题,我深表歉意。看起来答案应该很容易通过谷歌搜索,但我还没有找到。

我正在开发一个大型 Coldfusion 应用程序,该应用程序在客户端范围内存储大量会话/用户数据(即)。我没有编写这个应用程序,而且我也没有能力对其进行重大重构。

我的任务是将客户端变量设置为 72 小时后超时。我不完全确定如何做到这一点。如果我编写了应用程序,我会将变量存储在 Session 范围中,然后更改 CFAPPLICATION 标记的 sessiontimeout 属性。但事实上,我不确定超时是否会影响客户端变量,或者它们的持久性级别是多少。应用程序现在的工作方式,客户端变量永远不会超时,只有清除用户的 cookie,或访问将所有客户端范围的应用程序变量设置为“”的注销页面,才会清除这些值。

当然,我可以创建某种时间戳变量,例如 Client.LastAccessDateTime,并在 Application.cfm 中放入一些内容,以便在该日期时间早于 Now() 72 小时以上时清除客户端变量。但一定有更好的方法,对吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

七色彩虹 2024-09-02 13:27:06

根据您是否使用数据源或注册表作为客户端存储,您必须在

ColdFusion 管理员 => 客户端变量 => 注册表

上设置“清除 90 天到 3 天(=72 小时)内未访问的客户端的数据”或

客户端变量 =>NameOfDatabase 页面。

如果客户端变量存储为 cookie,则在设置 cookie 时您必须调整过期时间。

客户端变量页面上的清除间隔仅控制频率。 ColdFusion 对您的客户端存储执行清除操作(= 寻找过期的客户端变量以便删除它们)。

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

疯了 2024-09-02 13:27:06

我想您正在寻找清除间隔设置,该设置是在CF管理员的“服务器设置”>“CF管理员”中配置的。客户端变量页面。默认间隔为 1 小时 7 分钟。

编辑:此设置值并不完全是您所需要的。抱歉,请参阅我关于清除的评论 - 认为它更准确。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文