Coldfusion 会话管理和锁定变量

发布于 2024-10-05 15:22:50 字数 267 浏览 0 评论 0原文

我一直在阅读有关锁定各种持久变量、应用程序、会话等的内容,并且我了解读取经常更新的应用程序变量时存在的竞争条件。

我不太确定会话变量和应用程序变量不会改变。我在一台服务器上,CF9。我在设置会话变量时锁定它们,但是在读取它们时真的有必要锁定它们吗?每个用户不是都有自己的一组会话变量吗?更改一个用户的值将如何影响同时查看同一页面的不同用户。

另外,我在 application.cfc 文件中设置了应用程序变量,但它们没有更改。每次读取 application.dsn 变量时都需要锁吗?

I've been reading about locking the various persistent variables, application, session, etc. and I understand the race conditions that exists with reading application variables that are updated often.

I'm not so sure about session variables and application variables that don't change. I am on a single server and CF9. I'm locking the session variables when I set them, but is it really necessary to lock them when reading them. Doesn't each user have their own set of session variables. How would changing values for one user effect an different user viewing the same page at the same time.

Also, I set application variables in my application.cfc file and they do not change. Are locks needed every time I read the application.dsn variable?

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

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

发布评论

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

评论(1

美人如玉 2024-10-12 15:22:50

您不需要锁定会话变量,除非您的应用程序的一部分将直接修改用户的会话(这是 CF 中未记录的功能的一部分,因此您不太可能这样做)。

至于应用程序变量,如果您只设置一次并且不再弄乱它们,则不需要锁定它们。

You don't need to lock session variables unless you have part of your app that is going to be modifying the user's session directly (which is part of an undocumented feature in CF, so it's not likely you're doing that anyway).

As for Application variables, you shouldn't need to lock those either if you're just setting them once and never messing with them again.

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