function removeStaleCacheEntry(val, key) {
  if (!val[CACHE_KEYS]) return;
  for (const [prefix, id, newData] of this) {
    const prop = propsToClear[prefix];
    if (val[prop]?.includes(+id || id)) {
      if (prefix === S_REQUIRE_PRE) {
        val.depsMap[id].forEach(scriptId => cache.del(S_SCRIPT_PRE + scriptId));
      } else if (prefix === S_VALUE_PRE) {
        if (val[S_VALUE]) val[S_VALUE][id] = newData; // envDelayed
        setBaggedScriptValues(val, +id, newData);
        if (!val[CSAPI_REG]) continue;
      }
      cache.del(key); // TODO: try to patch the cache in-place?
    }
  }
}
@this {string[][]} changed storage keys, already split as [prefix,id]