public final class LeastRecentelyUsedImageCache
extends java.util.LinkedHashMap<java.lang.String,java.awt.image.BufferedImage>
LinkedHashMap
. This cache can hold a fixed a number of
BufferedImage
elements, until the specified memory limit is reached. If a new element is added, and the cache
is full, the least recently used entry is removed.Modifier and Type | Field and Description |
---|---|
private long |
maxCacheSize |
private java.lang.String |
maxCacheSizeReadable |
private static long |
serialVersionUID |
Constructor and Description |
---|
LeastRecentelyUsedImageCache(int maxCacheSizeInMBit) |
LeastRecentelyUsedImageCache(long maxCacheSize) |
Modifier and Type | Method and Description |
---|---|
long |
getCurrentSize() |
double |
getCurrentSizeInMBit() |
long |
getMaxCacheSize() |
long |
getMaxCacheSizeInMBit() |
protected boolean |
removeEldestEntry(java.util.Map.Entry<java.lang.String,java.awt.image.BufferedImage> eldest) |
void |
setMaxCacheSize(long maxCacheSize) |
void |
setMaxCacheSizeInMBit(int maxCacheSizeInMBit) |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
private static final long serialVersionUID
private long maxCacheSize
private java.lang.String maxCacheSizeReadable
public LeastRecentelyUsedImageCache(int maxCacheSizeInMBit)
public LeastRecentelyUsedImageCache(long maxCacheSize)
protected boolean removeEldestEntry(java.util.Map.Entry<java.lang.String,java.awt.image.BufferedImage> eldest)
removeEldestEntry
in class java.util.LinkedHashMap<java.lang.String,java.awt.image.BufferedImage>
public long getMaxCacheSize()
public long getMaxCacheSizeInMBit()
public void setMaxCacheSize(long maxCacheSize)
maxCacheSize
- The maxCacheSize to set.public void setMaxCacheSizeInMBit(int maxCacheSizeInMBit)
public long getCurrentSize()
public double getCurrentSizeInMBit()