Do not refresh use time for tiles when collecting used source tiles

This commit is contained in:
Maximilian Krög
2022-06-28 16:37:03 +02:00
parent e0d6ee3308
commit 7b9fc4c995
2 changed files with 15 additions and 2 deletions

View File

@@ -240,8 +240,9 @@ class VectorTile extends UrlTile {
const tileCache = this.getTileCacheForProjection(projection);
const usedSourceTiles = Object.keys(usedTiles).reduce((acc, key) => {
const cacheKey = getCacheKeyForTileKey(key);
if (tileCache.containsKey(cacheKey)) {
const sourceTiles = tileCache.get(cacheKey).sourceTiles;
const tile = tileCache.peek(cacheKey);
if (tile) {
const sourceTiles = tile.sourceTiles;
for (let i = 0, ii = sourceTiles.length; i < ii; ++i) {
acc[sourceTiles[i].getKey()] = true;
}

View File

@@ -214,6 +214,18 @@ class LRUCache {
return this.newest_.key_;
}
/**
* Return an entry without updating least recently used time.
* @param {string} key Key.
* @return {T} Value.
*/
peek(key) {
if (!this.containsKey(key)) {
return undefined;
}
return this.entries_[key].value_;
}
/**
* @return {T} value Value.
*/