简体   繁体   English

代码变量与应用程序和会话变量

[英]Code Variables vs. Application and Session Variables

With respect to classic ASP, are variables defined within individual code files, such as Const var1 = "foo" , and so on, maintained per-user or per-server/web-site? 对于经典ASP,是否在单个代码文件中定义了变量,例如Const var1 = "foo"等,是按用户还是按服务器/网站维护的? In other words, is it more efficient to define global or public variables (for use by all site users) as Application variables, or does it matter as far as performance and speed are concerned? 换句话说,将全局或公共变量(供所有站点用户使用)定义为应用程序变量是否更有效,或者就性能和速度而言是否重要?

The variables are per-request. 变量是每个请求的。

Session variables are per-user in a website. 会话变量是网站中每个用户的。

Application variables are for the whole application (ie website). 应用程序变量适用于整个应用程序(即网站)。

Note that on a busy site, overuse of session variables leads to memory pressure (it isn't very efficient), so usage should be kept to a minimum. 请注意,在繁忙的站点上,过度使用会话变量会导致内存压力(效率不是很高),因此应将使用量保持在最低水平。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM