# all files / ol/ tilecache.js

50% Statements 7/14
0% Branches 0/4
50% Functions 1/2
50% Lines 7/14

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    361×

    1×
    1×

    1×

    1×

    1×

    1×

     goog.provide('ol.TileCache');

    goog.require('ol');
    goog.require('ol.structs.LRUCache');

    /**
     * @constructor
     * @extends {ol.structs.LRUCache.<ol.Tile>}
     * @param {number=} opt_highWaterMark High water mark.
     * @struct
     */
    ol.TileCache = function(opt_highWaterMark) {

      ol.structs.LRUCache.call(this, opt_highWaterMark);

    };
    ol.inherits(ol.TileCache, ol.structs.LRUCache);

    /**
     * @param {Object.<string, ol.TileRange>} usedTiles Used tiles.
     */
    ol.TileCache.prototype.expireCache = function(usedTiles) {
      var tile, zKey;
      while (this.canExpireCache()) {
        tile = this.peekLast();
        zKey = tile.tileCoord[0].toString();
        if (zKey in usedTiles && usedTiles[zKey].contains(tile.tileCoord)) {
          break;
        } else {
          this.pop().dispose();
        }
      }
    };