Adam Heath wrote:
Adrian Crum wrote:
Adam Heath wrote:
Things to note: UtilCache is now generified; so are classes in
util/collections.
It would be cool if UtilCache implemented a basic cache interface, so
that other classes can cache their data in an implementation-safe manner
- by implementing the same interface.
See the comment in ServiceEcaUtil.java, line 52. ServiceEcaUtil could
have a contained class that implements the cache interface so that the
concerns mentioned in that comment could be addressed.
Ok, I read that, and the code that access ecaCache. The comment makes
no sense, you would never want to use UtilCache here.
Now, if you are wanting some code of auto-building map, where a request
for a non-existant key builds the value automatically(with reference
handling, lru, disk serialization stuff handled too), then yes, that
would be useful.
But in ServiceEcaUtil, it wouldn't. You'd have to change the component
stuff(probably, I'm not going to study that part again right this
moment) to make it a bit easier to access in piecemeal.
I wasn't suggesting using UtilCache - I was suggesting using a ServiceEcaUtil implementation of a
basic cache interface. When the interface's cache clear method is called, the ServiceEcaUtil
implementation of the interface would clear the Map, then reload the ECAs.
Other classes could do the same thing in the cases where using UtilCache would be dangerous or
undesirable.