How to check whether cache needs to be refreshed
How to check whether cache needs to be refreshed
- Subject: How to check whether cache needs to be refreshed
- From: email@hidden
- Date: Tue, 14 Aug 2001 21:59:42 -0400
I've got a number of scripts that retrieve information from files and from
applications, and I've provided caching to those were re-reading and
re-digesting the data or re-querying to application takes too much time.
However, I also deploy these scripts at two customer sites, and have been fooled
by cache coherency breakdowns. In some cases, the cache doesn't accurately
represent the data in the outside world.
For a file, I currently check the cache's freshness by checking the name,
creation date, modification date, size, short version, and long version
properties of the 'info for' record. But I've been fooled by files changing
"behind the back" of my script, when the script is deployed to a different
machine. So, is there any way to quickly get a unique or probably-unique
identifier for the current machine. (Remember, the objective is to avoid
re-reading disk files and calling slow applications, so getting the Ethernet
address or running Apple System Profiler is undesirable.)
Are there other ways where a cache freshness checker could be fooled, that I
should guard against?
For applications, it gets harder. My scripts are interacting with ListSTAR
Server, which can become busy and cause timeouts when its heavily loaded
processing a flood of mail ("Oh, the mail service has been down for 12 hours?
Let me fix it. Here it comes......"). My cache script acts like an executive
assistant to ListSTAR, but was seriously fooled when I deployed it from the
development site to the live site. Knowing that the machine name changed may
help prevent that, but can anyone think of some other clever way to realize that
the information I've cached from the application is no longer valid? (I'm
looking at a few key files that change their date when the information changes,
which reduces the problem to one of file-cache coherency, but it gets
inefficient because sometimes the file changes don't mean the cache is stale.)
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden