Package org.mapsforge.map.layer.cache
Interface TileCache
-
- All Superinterfaces:
ObservableInterface
- All Known Implementing Classes:
FileSystemTileCache,InMemoryTileCache,TileStore,TwoLevelTileCache
public interface TileCache extends ObservableInterface
Interface for tile image caches.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancontainsKey(Job key)voiddestroy()Destroys this cache.org.mapsforge.core.graphics.TileBitmapget(Job key)intgetCapacity()intgetCapacityFirstLevel()org.mapsforge.core.graphics.TileBitmapgetImmediately(Job key)Returns tileBitmap only if available at fastest cache in case of multi-layered cache, null otherwise.voidpurge()Purges this cache.voidput(Job key, org.mapsforge.core.graphics.TileBitmap bitmap)voidsetWorkingSet(java.util.Set<Job> workingSet)Reserves a working set in this cache, for multi-level caches this means bringing the elements in workingSet into the fastest cache.-
Methods inherited from interface org.mapsforge.map.model.common.ObservableInterface
addObserver, removeObserver
-
-
-
-
Method Detail
-
containsKey
boolean containsKey(Job key)
- Returns:
- true if this cache contains an image for the given key, false otherwise.
- See Also:
Map.containsKey(java.lang.Object)
-
destroy
void destroy()
Destroys this cache. Applications are expected to call this method when they no longer require the cache. In versions prior to 0.5.1, it was common practice to call this method but continue using the cache, in order to empty it, forcing all tiles to be re-rendered or re-requested from the source. Beginning with 0.5.1,purge()should be used for this purpose. The earlier practice is now discouraged and may lead to unexpected results when used with features introduced in 0.5.1 or later.
-
get
org.mapsforge.core.graphics.TileBitmap get(Job key)
- Returns:
- the image for the given key or null, if this cache contains no image for the key.
- See Also:
Map.get(java.lang.Object)
-
getCapacity
int getCapacity()
- Returns:
- the capacity of this cache.
-
getCapacityFirstLevel
int getCapacityFirstLevel()
- Returns:
- the capacity of the first level of a multi-level cache.
-
getImmediately
org.mapsforge.core.graphics.TileBitmap getImmediately(Job key)
Returns tileBitmap only if available at fastest cache in case of multi-layered cache, null otherwise.- Returns:
- tileBitmap if available without getting from lower storage levels
-
purge
void purge()
Purges this cache. Calls toget(Job)issued after purging will not return any tiles added before the purge operation. Applications should purge the tile cache when map model parameters change, such as the render style for locally rendered tiles, or the source for downloaded tiles. Applications which frequently alternate between a limited number of map model configurations may want to consider using a different cache for each.- Since:
- 0.5.1
-
put
void put(Job key, org.mapsforge.core.graphics.TileBitmap bitmap)
- Throws:
java.lang.IllegalArgumentException- if any of the parameters isnull.- See Also:
Map.put(K, V)
-
setWorkingSet
void setWorkingSet(java.util.Set<Job> workingSet)
Reserves a working set in this cache, for multi-level caches this means bringing the elements in workingSet into the fastest cache.
-
-