public class IntArrayCache extends Object implements IMemoryManageable
IMemoryManageable.FreeMemoryLevel| Modifier and Type | Method and Description |
|---|---|
void |
free(int[] array)
Put an array in the cache.
|
void |
freeMemory(IMemoryManageable.FreeMemoryLevel level)
Request to free some memory.
|
int[] |
get(int size,
boolean acceptGreater)
Get an array.
|
String |
getDescription()
Desciption.
|
static IntArrayCache |
getInstance()
Get the default instance.
|
List<String> |
getItemsDescription()
Describe each item that can be freed.
|
int |
getMaxBuffersBySizeAbove128KB()
Maximum number of buffers of the same size to keep, when size is above 128K, default to 8.
|
int |
getMaxBuffersBySizeUnder128KB()
Maximum number of buffers of the same size to keep, when size is under 128K, default to 20.
|
int |
getMaxTotalSize()
Maximum total size of buffers to keep in this cache.
|
long |
getTimeBeforeToRemove()
Time before a cached buffer can be removed to free memory.
|
void |
setMaxBuffersBySizeAbove128KB(int maxBuffersBySizeAbove128KB)
Maximum number of buffers of the same size to keep, when size is above 128K, default to 8.
|
void |
setMaxBuffersBySizeUnder128KB(int maxBuffersBySizeUnder128KB)
Maximum number of buffers of the same size to keep, when size is under 128K, default to 20.
|
void |
setMaxTotalSize(int maxTotalSize)
Maximum total size of buffers to keep in this cache.
|
void |
setTimeBeforeToRemove(long timeBeforeToRemove)
Time before a cached buffer can be removed to free memory.
|
public static IntArrayCache getInstance()
public int getMaxBuffersBySizeUnder128KB()
public void setMaxBuffersBySizeUnder128KB(int maxBuffersBySizeUnder128KB)
public int getMaxBuffersBySizeAbove128KB()
public void setMaxBuffersBySizeAbove128KB(int maxBuffersBySizeAbove128KB)
public int getMaxTotalSize()
public void setMaxTotalSize(int maxTotalSize)
public long getTimeBeforeToRemove()
public void setTimeBeforeToRemove(long timeBeforeToRemove)
public int[] get(int size,
boolean acceptGreater)
public void free(int[] array)
public String getDescription()
IMemoryManageablegetDescription in interface IMemoryManageablepublic List<String> getItemsDescription()
IMemoryManageablegetItemsDescription in interface IMemoryManageablepublic void freeMemory(IMemoryManageable.FreeMemoryLevel level)
IMemoryManageablefreeMemory in interface IMemoryManageableCopyright © 2019. All rights reserved.