public class

MemoryCacheTileDataSource

extends CacheTileDataSource
java.lang.Object
   ↳ com.carto.datasources.TileDataSource
     ↳ com.carto.datasources.CacheTileDataSource
       ↳ com.carto.datasources.MemoryCacheTileDataSource

Class Overview

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.

Summary

Public Constructors
MemoryCacheTileDataSource(TileDataSource dataSource)
Constructs a MemoryCacheTileDataSource object from tile data source.
Public Methods
void clear()
Clear the cache.
synchronized void delete()
long getCapacity()
Returns the tile cache capacity.
TileData loadTile(MapTile mapTile)
Loads the specified tile.
void setCapacity(long capacityInBytes)
Sets the cache capacity.
[Expand]
Inherited Methods
From class com.carto.datasources.CacheTileDataSource
From class com.carto.datasources.TileDataSource
From class java.lang.Object

Public Constructors

public MemoryCacheTileDataSource (TileDataSource dataSource)

Constructs a MemoryCacheTileDataSource object from tile data source.

Parameters
dataSource The datasource to be cached.

Public Methods

public void clear ()

Clear the cache.

public synchronized void delete ()

public long getCapacity ()

Returns the tile cache capacity.

Returns
  • The tile cache capacity in bytes.

public TileData loadTile (MapTile mapTile)

Loads the specified tile.
Note: the tile coordinate system used here is vertically flipped relative to layer tile coordinate system.

Parameters
mapTile The tile to load.
Returns
  • The tile data. If the tile is not available, null may be returned.

public void setCapacity (long capacityInBytes)

Sets the cache capacity.

Parameters
capacityInBytes The new tile cache capacity in bytes.