Package com.kheops.jmap.client.layers
Class JMapLocalTileCache
java.lang.Object
com.kheops.jmap.client.layers.JMapLocalTileCache
This class manages and stores tile as disk cache to reduce tile request
 on the sever
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionJMapLocalTileCache(String jmsUID, File path, long diskCacheSize) Constructs the JMapLocalTileCache instance the data will be stored on the specified path
- 
Method SummaryModifier and TypeMethodDescriptionvoiddeleteTile(int projectId, int layerId, int tilePos) Remove the specified tile from the cache of the specified layer.voiddeleteTiles(int projectId, int layerId) Removes all tiles from the cache of the specified layer.voiddestroy()longgetStoredTimestamp(int projectId, int layerId) longgetTilesSize(int projectId, int layerId) Returns the size on disk for a layer in a projectvoidinit()booleanisInCache(int projectId, int layerId, int tilePos) Checks if specific tile is in cachebyte[]retrieveTile(int projectId, int layerId, int tilePos) Retrieves a compressed tile from the cachevoidsetStoredTimestamp(int projectId, int layerId, long timeStamp) voidstoreTile(byte[] tileData, int projectId, int layerId, int tilePos, long expiration) Stores the tile on disk
- 
Constructor Details- 
JMapLocalTileCacheConstructs the JMapLocalTileCache instance the data will be stored on the specified path- Parameters:
- jmsUID- the JMapServer Unique ID (Serial Number)
- path- the base directory for storing the tiles
- diskCacheSize- the allowed size to be used as disk cache. -1 means unlimited.
 
 
- 
- 
Method Details- 
initpublic void init()
- 
destroypublic void destroy()
- 
storeTilepublic void storeTile(byte[] tileData, int projectId, int layerId, int tilePos, long expiration) Stores the tile on disk- Parameters:
- tileData- the tile data to be stored
- projectId- the id of the project
- layerId- the id of the layer from which the tile will be stored
- tilePos- the tile position on the layer from which the tile will be stored
 
- 
retrieveTilepublic byte[] retrieveTile(int projectId, int layerId, int tilePos) Retrieves a compressed tile from the cache- Parameters:
- projectId- the id of the project
- layerId- the id of the layer from which the tile will be retrieved
- tilePos- the tile position on the layer from which the tile will be retrieved
- Returns:
- the compressed tile
 
- 
isInCachepublic boolean isInCache(int projectId, int layerId, int tilePos) Checks if specific tile is in cache- Parameters:
- projectId- the id of the project
- layerId- the id of the layer of the tile search for
- tilePos- the position of the tile in the layer
- Returns:
- true if the cache contains the specific tile false otherwise
 
- 
deleteTilepublic void deleteTile(int projectId, int layerId, int tilePos) Remove the specified tile from the cache of the specified layer.- Parameters:
- projectId- the project Id.
- layerId- the layer id.
- tilePos- the position of the tile in the layer
 
- 
deleteTilespublic void deleteTiles(int projectId, int layerId) Removes all tiles from the cache of the specified layer.- Parameters:
- projectId- the project Id.
- layerId- the layer id.
 
- 
getTilesSizepublic long getTilesSize(int projectId, int layerId) Returns the size on disk for a layer in a project- Parameters:
- projectId- the project id.
- layerId- the layer id.
- Returns:
- the size on disk for a layer in a project.
 
- 
getStoredTimestamp- Throws:
- IOException
 
- 
setStoredTimestamp- Throws:
- IOException
 
 
-