Class MemoryCacheTileDataSource


public class MemoryCacheTileDataSource extends CacheTileDataSource
A tile data source that loads tiles from another tile data source
and caches them in memory. This cache is not persistent, tiles
will be cleared once the application closes. Default cache capacity is 6MB.
  • Constructor Details

    • MemoryCacheTileDataSource

      public MemoryCacheTileDataSource(TileDataSource dataSource)
      Constructs a MemoryCacheTileDataSource object from tile data source.
      Parameters:
      dataSource - The datasource to be cached.
  • Method Details

    • loadTile

      public TileData loadTile(MapTile mapTile)
      Description copied from class: TileDataSource
      Loads the specified tile.
      Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.
      Overrides:
      loadTile in class TileDataSource
      Parameters:
      mapTile - The tile to load.
      Returns:
      The tile data. If the tile is not available, null may be returned.
    • clear

      public void clear()
      Description copied from class: CacheTileDataSource
      Clear the cache.
      Overrides:
      clear in class CacheTileDataSource
    • getCapacity

      public long getCapacity()
      Description copied from class: CacheTileDataSource
      Returns the tile cache capacity.
      Overrides:
      getCapacity in class CacheTileDataSource
      Returns:
      The tile cache capacity in bytes.
    • setCapacity

      public void setCapacity(long capacityInBytes)
      Description copied from class: CacheTileDataSource
      Sets the cache capacity.
      Overrides:
      setCapacity in class CacheTileDataSource
      Parameters:
      capacityInBytes - The new tile cache capacity in bytes.