gov.nasa.worldwind.cache
Class BasicTextureCache
java.lang.Object
gov.nasa.worldwind.cache.BasicTextureCache
- All Implemented Interfaces:
- TextureCache
public class BasicTextureCache
- extends Object
- implements TextureCache
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BasicTextureCache
public BasicTextureCache(long loWater,
long hiWater)
clear
public void clear()
- Specified by:
clear
in interface TextureCache
contains
public boolean contains(Object key)
- Specified by:
contains
in interface TextureCache
get
public com.sun.opengl.util.texture.Texture get(Object key)
- Specified by:
get
in interface TextureCache
getCapacity
public long getCapacity()
- Specified by:
getCapacity
in interface TextureCache
getFreeCapacity
public long getFreeCapacity()
- Specified by:
getFreeCapacity
in interface TextureCache
getLowWater
public long getLowWater()
- Returns the low water level in bytes. When the cache fills, it removes items until it reaches the low water
level.
- Specified by:
getLowWater
in interface TextureCache
- Returns:
- the low water level in bytes.
getNumObjects
public int getNumObjects()
- Specified by:
getNumObjects
in interface TextureCache
getUsedCapacity
public long getUsedCapacity()
- Specified by:
getUsedCapacity
in interface TextureCache
put
public void put(Object key,
com.sun.opengl.util.texture.Texture texture)
- Specified by:
put
in interface TextureCache
remove
public void remove(Object key)
- Specified by:
remove
in interface TextureCache
setCapacity
public void setCapacity(long newCapacity)
- Sets the new capacity (in bytes) for the cache. When decreasing cache size, it is recommended to check that the
lowWater variable is suitable. If the capacity infringes on items stored in the cache, these items are removed.
Setting a new low water is up to the user, that is, it remains unchanged and may be higher than the maximum
capacity. When the low water level is higher than or equal to the maximum capacity, it is ignored, which can lead
to poor performance when adding entries.
- Specified by:
setCapacity
in interface TextureCache
- Parameters:
newCapacity
- the new capacity of the cache.
setLowWater
public void setLowWater(long loWater)
- Sets the new low water level in bytes, which controls how aggresively the cache discards items.
When the cache fills, it removes items until it reaches the low water level.
Setting a high loWater level will increase cache misses, but decrease average add time, but setting a low loWater
will do the opposite.
- Specified by:
setLowWater
in interface TextureCache
- Parameters:
loWater
- the new low water level in bytes.