public class DirectBufferCache extends Object
To reduce contention, entry allocation and eviction execute in a sampling fashion (entry hits modulo N). Eviction follows an LRU approach (oldest sampled entries are removed first) when the cache is out of capacity
In order to expedite reclamation, cache entries are reference counted as opposed to garbage collected.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
DirectBufferCache.CacheEntry |
| Modifier and Type | Field | Description |
|---|---|---|
static int |
MAX_AGE_NO_CACHING |
Max age 0, indicating that entries expire upon creation and are not retained;
|
static int |
MAX_AGE_NO_EXPIRY |
Mage age -1, entries dont expire
|
| Constructor | Description |
|---|---|
DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory) |
|
DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory,
org.xnio.BufferAllocator<ByteBuffer> bufferAllocator) |
|
DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory,
org.xnio.BufferAllocator<ByteBuffer> bufferAllocator,
int maxAge) |
| Modifier and Type | Method | Description |
|---|---|---|
DirectBufferCache.CacheEntry |
add(Object key,
int size) |
|
DirectBufferCache.CacheEntry |
add(Object key,
int size,
int maxAge) |
|
DirectBufferCache.CacheEntry |
get(Object key) |
|
Set<Object> |
getAllKeys() |
Returns a set of all the keys in the cache.
|
void |
remove(Object key) |
public static final int MAX_AGE_NO_CACHING
public static final int MAX_AGE_NO_EXPIRY
public DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory)
public DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory,
org.xnio.BufferAllocator<ByteBuffer> bufferAllocator)
public DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory,
org.xnio.BufferAllocator<ByteBuffer> bufferAllocator,
int maxAge)
public DirectBufferCache.CacheEntry add(Object key, int size)
public DirectBufferCache.CacheEntry add(Object key, int size, int maxAge)
public DirectBufferCache.CacheEntry get(Object key)
public Set<Object> getAllKeys()
public void remove(Object key)
Copyright © 2026 JBoss by Red Hat. All rights reserved.