injectCache(options) {
            const targetKey = options.targetKey,
                tile = options.tile;
            if (!options.tileAllowNotLoaded && !tile.loaded && !tile.loading) {
                $.console.warn("Attempt to inject cache on tile in invalid state: this is probably a bug!");
                return;
            }
            const consumer = this._cachesLoaded[targetKey];
            if (consumer) {
                // We need to avoid async execution here: replace consumer instead of overwriting the data.
                const iterateTiles = [...consumer._tiles];  // unloadCacheForTile() will modify the array, use a copy
                for (let tile of iterateTiles) {
                    this.unloadCacheForTile(tile, targetKey, true, false);
                }
            }
            if (this._cachesLoaded[targetKey]) {
                $.console.error("The inject routine should've freed cache!");
            }

            const cache = options.cache;
            this._cachesLoaded[targetKey] = cache;

            // Update cache: add the new cache, we must add since we removed above with unloadCacheForTile()
            for (let t of tile.getCache(tile.originalCacheKey)._tiles) {  // grab all cache-equal tiles
                t.setCache(targetKey, cache, options.setAsMainCache, false);
            }
        }
Inject new cache to the system
@param {Object} options
@param {OpenSeadragon.Tile} options.tile - Reference tile. All tiles sharing original data will be affected.
@param {OpenSeadragon.CacheRecord} options.cache - Cache that will be injected.
@param {String} options.targetKey - The target cache key to inhabit. Can replace existing cache.
@param {Boolean} options.setAsMainCache - If true, tiles main cache gets updated to consumerKey.
  Otherwise, if consumerKey==tile.cacheKey the cache is set as main too.
@param {Boolean} options.tileAllowNotLoaded - if true, tile that is not loaded is also processed,
  this is internal parameter used in tile-loaded completion routine, as we need to prepare tile but
  it is not yet loaded and cannot be marked as so (otherwise the system would think it is ready)
@private