this.configuration = configuration;
}
public Object get(Source source, String prefix) {
String key = prefix + source.getURI();
SourceValidity newValidity = source.getValidity();
// If source is not valid then remove object from cache and return null
if (newValidity == null) {
this.cache.remove(key);
return null;
}
// If object is not in cache then return null
Object[] objectAndValidity = (Object[]) this.cache.get(key);
if (objectAndValidity == null) {
return null;
}
// Check stored validity against current source validity
SourceValidity storedValidity = (SourceValidity) objectAndValidity[1];
int valid = storedValidity.isValid();
boolean isValid;
if (valid == SourceValidity.UNKNOWN) {
valid = storedValidity.isValid(newValidity);
isValid = (valid == SourceValidity.VALID);
} else {
isValid = (valid == SourceValidity.VALID);
}