public class InMemoryTileCache extends java.lang.Object implements TileCache
| Constructor and Description |
|---|
InMemoryTileCache(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
addObserver(Observer observer) |
boolean |
containsKey(Job key) |
void |
destroy()
Destroys this cache.
|
org.mapsforge.core.graphics.TileBitmap |
get(Job key) |
int |
getCapacity() |
int |
getCapacityFirstLevel() |
org.mapsforge.core.graphics.TileBitmap |
getImmediately(Job key)
Returns tileBitmap only if available at fastest cache in case of multi-layered cache, null otherwise.
|
void |
purge()
Purges this cache.
|
void |
put(Job key,
org.mapsforge.core.graphics.TileBitmap bitmap) |
void |
removeObserver(Observer observer) |
void |
setCapacity(int capacity)
Sets the new size of this cache.
|
void |
setWorkingSet(java.util.Set<Job> jobs)
Reserves a working set in this cache, for multi-level caches this means bringing the elements in workingSet into
the fastest cache.
|
public InMemoryTileCache(int capacity)
capacity - the maximum number of entries in this cache.java.lang.IllegalArgumentException - if the capacity is negative.public boolean containsKey(Job key)
containsKey in interface TileCacheMap.containsKey(java.lang.Object)public void destroy()
TileCacheTileCache.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.public org.mapsforge.core.graphics.TileBitmap get(Job key)
public int getCapacity()
getCapacity in interface TileCachepublic int getCapacityFirstLevel()
getCapacityFirstLevel in interface TileCachepublic org.mapsforge.core.graphics.TileBitmap getImmediately(Job key)
TileCachegetImmediately in interface TileCachepublic void purge()
TileCacheTileCache.get(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.public void put(Job key, org.mapsforge.core.graphics.TileBitmap bitmap)
public void setCapacity(int capacity)
capacity - the new maximum number of entries in this cache.java.lang.IllegalArgumentException - if the capacity is negative.public void setWorkingSet(java.util.Set<Job> jobs)
TileCachesetWorkingSet in interface TileCachepublic void addObserver(Observer observer)
addObserver in interface ObservableInterfacepublic void removeObserver(Observer observer)
removeObserver in interface ObservableInterface