public final class SimpleByteCache extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
acquire(int size)
Get the next available array, either from the cache or a brand new one
|
static void |
clearAll()
Clear everything (memory pressure)
|
static SimpleByteCache |
getInstance(int size)
Get a cache responsible for arrays of the given size
|
static SimpleByteCache |
getInstance(int cacheSize,
int size)
Get a cache responsible for objects of the given size
|
static void |
release(byte[] entry)
Put this array back onto the available cache for reuse
|
public static SimpleByteCache getInstance(int size)
size
- how large should the objects cached be?public static SimpleByteCache getInstance(int cacheSize, int size)
cacheSize
- how large we want the cache to grow
(number of objects, NOT memory size)
before discarding released objects.size
- how large should the objects cached be?public static void clearAll()
public static byte[] acquire(int size)
public static void release(byte[] entry)