Add method to set max cache size in ol.style.IconImageCache

This commit is contained in:
Bobo Häggström
2017-10-19 09:43:54 +02:00
parent a5a0f5b98b
commit 343a4085a0
2 changed files with 31 additions and 1 deletions

View File

@@ -21,7 +21,6 @@ ol.style.IconImageCache = function() {
this.cacheSize_ = 0;
/**
* @const
* @type {number}
* @private
*/
@@ -91,3 +90,13 @@ ol.style.IconImageCache.prototype.set = function(src, crossOrigin, color, iconIm
this.cache_[key] = iconImage;
++this.cacheSize_;
};
/**
* Set cache max size.
* @param {number} maxCacheSize Cache max size.
*/
ol.style.IconImageCache.prototype.setMaxCacheSize = function(maxCacheSize) {
this.maxCacheSize_ = maxCacheSize;
this.expire();
};