Coldfusion 会话管理和锁定变量
我一直在阅读有关锁定各种持久变量、应用程序、会话等的内容,并且我了解读取经常更新的应用程序变量时存在的竞争条件。
我不太确定会话变量和应用程序变量不会改变。我在一台服务器上,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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不需要锁定会话变量,除非您的应用程序的一部分将直接修改用户的会话(这是 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.