如何每天重置应用程序变量 [英] How to reset an application variable daily

查看:315
本文介绍了如何每天重置应用程序变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个节目录制服务电话和处理完成。我们有一批谁打开用户和附近的电话,我想在所有时间呼叫的总数今天打开和总数今天关闭和它们之间的差值来显示。我想有一个应用程序变量做这件事的。我每天都为这些变量重置为0。我会在哪里做呢?我在Global.asax,但在这种情况可能是做思想?在应用程序运行所有的时间,所以我想的Application_Start是不恰当的。那么在哪里?谢谢你。

I am writing a program recording service calls and treatment done. We have a number of users who open and close calls and I want to show at all times the total number of calls opened today and the total number closed today and the difference between them. I thought of doing it with an application variable. I have to reset these variables to 0 every day. Where would I do that? I thought in the Global.asax but in which event could that be done? The application is running all the time so I suppose Application_Start wouldn't be appropriate. So where? Thank you.

推荐答案

我会存储到数据库的调用,并做一个选择哪些组由当天获得的总呼叫等进行显示。

I would store the calls to a database and do a select which groups by the current day to get the total calls, etc. for display.

这样,新的一天开始时,它会自动重置你,你不必担心IIS将复位摧毁你的内存中的数据。

That way it will automatically reset for you when a new day starts, and you don't need to worry about IIS Resets destroying your in memory data.

如果你不想询问过于频繁的性能损失,有许多可用的缓存选项。

If you don't want the performance hit of querying too often, there are a number of caching options available.

这篇关于如何每天重置应用程序变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆