Adrian Crum wrote:
> 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.

Ah, yes, I understand that.

But you do not want a clear() call to automatically repopulate.  You
only repopulate when the item is needed again.  Otherwise, the original
clear call didn't really have any affect(ie, for reducing memory).

> Other classes could do the same thing in the cases where using UtilCache
> would be dangerous or undesirable.

Well, if the 'cache' user can always recreate the values from the given
key, it's not really a problem; just additional load.

For those who care, this kind of auto-create-value-base-on-key is called
autovivification; it's something I learned while working with perl.

Reply via email to