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 and Description |
---|---|
static class |
DirectBufferCache.CacheEntry |
Constructor and Description |
---|
DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory) |
DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory,
BufferAllocator<ByteBuffer> bufferAllocator) |
DirectBufferCache(int sliceSize,
int slicesPerPage,
int maxMemory,
BufferAllocator<ByteBuffer> bufferAllocator,
int maxAge) |
Modifier and Type | Method and 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 DirectBufferCache(int sliceSize, int slicesPerPage, int maxMemory)
public DirectBufferCache(int sliceSize, int slicesPerPage, int maxMemory, BufferAllocator<ByteBuffer> bufferAllocator)
public DirectBufferCache(int sliceSize, int slicesPerPage, int maxMemory, 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 © 2021 JBoss by Red Hat. All rights reserved.