A more explicit way to handle scheduled / timed events from inside an
ASP.NET application is to create a System.Timers.Timer object during
the Application_Start event in global.asax.
i.e.
protected void Application_Start(Object sender, EventArgs e)
{
System.Timers.Timer myTimer = new System.Timers.Timer();
myTimer.Enabled = true;
myTimer.Interval = (60000 * 15);
myTimer.Elapsed +=
new System.Timers.ElapsedEventHandler(myTimer_Elapsed) ;
}
protected void myTimer_Elapsed(
object sender,
System.Timers.ElapsedEventArgs e
)
{
// do some work
}
I wouldn't use the cache expiration to do anything other than refresh
the cache. Any other behavior might not be obvious to someone coming
in to do maintenance on the softwrae.
HTH,
--
Scott
http://www.OdeToCode.com
On Sat, 24 Apr 2004 00:07:18 -0500, "Ivan Demkovitch" <a@nospam.com>
wrote:
Hi!
If I understand caching properly:
1. Create object in cache and set expiration Time to let's say 1 minute
2. Specify delegate which will be called on object expiration. Here we will
restore object and do some other stuff.
Basically we have timer-like application which lives by itself without
user's hitting website.
Does anybody use this technique to schedule events or some specific
processing?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.657 / Virus Database: 422 - Release Date: 4/13/2004