//returns true if the cached value is valid function isCached(key) { var val = cache[key]; //dirty = invalidated; null = nonexisting (but actively cached as such) return val != undefined && (val == null || val.isDirty !== true); }