Merge pull request #6626 from ahocevar/reprojected-cache-size

Respect cacheSize for reprojected caches
This commit is contained in:
Andreas Hocevar
2017-03-22 16:27:11 +01:00
committed by GitHub
4 changed files with 22 additions and 5 deletions

View File

@@ -194,7 +194,7 @@ ol.source.TileImage.prototype.getTileCacheForProjection = function(projection) {
} else {
var projKey = ol.getUid(projection).toString();
if (!(projKey in this.tileCacheForProjection)) {
this.tileCacheForProjection[projKey] = new ol.TileCache();
this.tileCacheForProjection[projKey] = new ol.TileCache(this.tileCache.highWaterMark);
}
return this.tileCacheForProjection[projKey];
}

View File

@@ -15,10 +15,9 @@ ol.TileCache = function(opt_highWaterMark) {
ol.structs.LRUCache.call(this);
/**
* @private
* @type {number}
*/
this.highWaterMark_ = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
this.highWaterMark = opt_highWaterMark !== undefined ? opt_highWaterMark : 2048;
};
ol.inherits(ol.TileCache, ol.structs.LRUCache);
@@ -28,7 +27,7 @@ ol.inherits(ol.TileCache, ol.structs.LRUCache);
* @return {boolean} Can expire cache.
*/
ol.TileCache.prototype.canExpireCache = function() {
return this.getCount() > this.highWaterMark_;
return this.getCount() > this.highWaterMark;
};