I have to load data from 2 text files nightly to be used as lookups in a WiseJ app. This data is uploaded to our server every night at a specific time.
Thought about using the built in cache mechanism of ASP.net – but I believe i cannot set a specific time of day for it to expire the cache and reload from the text files.
The question is – can I set a “global” timer for tasks that need to be done – kind of like CRON jobs for a WiseJ application – maybe using background workers to perform the tasks ?
You don’t have to cache each item. You can place anything in the cache. I’d put it an object that contains a list of files and a callback method.
Thats the problem. I don’t want each item to fire an expiration. I want to refresh the entire list from the cache and reload because there will be new items to load and other items will no longer be in the file.
You can use HttpRuntime.Cache or System.Web.Caching.Cache which are basically the same thing. Look also under System.Runtime.Caching. You can use any of those. When adding an entry in the cache you can specify the absolute expiration or sliding expiration and a callback invoked when the item is removed by the cache.
You can also start any thread from your wisej app and handle things from there. Once the thread is started it goes by itself and has no relation to the wisej app.
Remember that an app pool recycle will clear the cache and stop all threads.
Please login first to submit.