Not sure this is the correct way of doing this, but I have a servlet that builds a list on startup and makes it available to the application. However one issue my creep up, is if I only restart teh app 3 times a week (automated), then that list gets updated 3 times a week, there that list could change once a day.
Can I use a cron command to re-run that servlet, or is there some better solution.
I wrote a class for exactly this purpose. It's called TtlReference. Basically, it maintains a reference to an object for a TTL (time to live) amount of time. A separate thread runs in the background to clear references that have expired.
James Carman, President<br />Carman Consulting, Inc.
Yes, cron will work fine if you have everything cached for the same duration (unless you want to maintain a bunch of cron commands). My solution is all Java and it works pretty well. There's no need to write a servlet which knows that it has to reload the objects at all. Your logic which accesses the data has to do a "lazy load" though. Actually, the real framework (I removed some code) has the option to place a listener on the reference so that you can auto-refresh the data behind the scenes, reducing the risk of a client having to wait for the refresh.