         resolve @_createTile z, x, y, buffer
 
   _createTile: (z, x, y, buffer) ->
-    tile = @cache[[z,x,y].join("-")] = new Tile @styler
+    name = [z,x,y].join("-")
+    @cached.push name
+
+    tile = @cache[name] = new Tile @styler
     tile.load buffer
 
   _initPersistence: ->

    if cached = @cache[[z,x,y].join("-")]
      return Promise.resolve cached

    switch @mode
      when @modes.MBTiles then @_getMBTile z, x, y
      when @modes.HTTP then @_getHTTP z, x, y


module.exports = class TileSource
  cache: {}
  cacheSize: 16
  cached: []

  modes:
    MBTiles: 1
    VectorTile: 2
