简体   繁体   English

经典ASP,应用程序变量,刷新

[英]Classic ASP, application variables, refreshing

I have an application variable which is populated onstart (in this case it is an array). 我有一个在启动时填充的应用程序变量(在这种情况下,它是一个数组)。 Ideally I need to rebuild this array every 3 hours, what is the best way of going about this? 理想情况下,我需要每3小时重建一次此阵列,最好的方法是什么?

Thanks, R. 谢谢,R。

Save the time you last refreshed the variable contents. 节省上一次刷新变量内容的时间。

On every request, check the current time against the saved time. 对于每个请求,请对照保存的时间检查当前时间。 If there's a three hour difference, lock and refresh the variable. 如果相差三个小时,请锁定并刷新变量。

As long as there are no requests, the variable also needs no refreshing. 只要没有请求,该变量也不需要刷新。

If your application variable must remain "in process" with the rest of the site's code, the way suggested by Tomalak may be your only way of achieving this. 如果您的应用程序变量必须与该网站的其余代码保持在“处理中”,则Tomalak建议的方法可能是实现此目标的唯一方法。

However, if it's possible that the application variable could effectively reside "out of process" of the website's ASP code (although still accessible by it), you may be able to utilise a different (and perhaps slightly better) approach. 但是,如果应用程序变量可以有效地驻留在网站的ASP代码的“进程外”(尽管仍然可以访问),则可以使用其他方法(也许稍微更好)。

Please see " ASP 101: Getting Scripts to Run on a Schedule " for the details. 有关详细信息,请参见“ ASP 101:使脚本按计划运行 ”。

Tomalak's method is effectively Method 1 in the article, whilst Method's 2 & 3 offer different ways of achieving what is effectively something happening on a schedule, and avoid the potentially redundant checking with every HTTP request. Tomalak的方法实际上是本文中的方法1,而方法2和3提供了实现计划中实际发生的事情的不同方法,并避免了每个HTTP请求的潜在冗余检查。

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

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