// f is a function or an instance of Cache (the dependee)
sclass DependentCache extends Cache {
O depF, lastDep;
*() {}
*(O *maker, O *depF) {}
A get() {
if (hasLock(lock)) ret value; // Must be called from within maker
{
lock lock;
O dep;
if (depF instanceof Cache) dep = depF/Cache.changeCount;
else {
dep = callF(depF);
if (dep instanceof Cache) dep = dep/Cache.changeCount;
}
if (neq(dep, lastDep)) {
clear();
lastDep = dep;
}
}
ret super.get();
}
}