E - The type of the elements.public class NQEvictor<E> extends AbstractEvictor<E>
RecencyEvictor (called levels) where if element
being added is in some of them, it is removed and added to the next level, or
if there is no next level, it is readded to the last one. Elements that are
in none of the levels are added to the first one. If there is only one level,
this evictor works as RecencyEvictor.
This is a straight-forward generalization of Segmented LRU cache <https://en.wikipedia.org/wiki/Cache_replacement_policies#Segmented_LRU_.28SLRU.29>
| Modifier and Type | Class and Description |
|---|---|
static class |
NQEvictor.Builder |
protected static class |
NQEvictor.ProtectedBuilder<B extends NQEvictor.ProtectedBuilder<B>> |
protected class |
NQEvictor.Stats |
stats| Modifier and Type | Method and Description |
|---|---|
void |
add(E element)
Add the provided element.
|
static NQEvictor.Builder |
builder() |
Iterator<E> |
evict(com.google.common.base.Predicate<E> retain)
Return elements that are evicted.
|
int |
getCapacity(int index) |
int |
getN() |
int |
setCapacity(int index,
int capacity) |
addAndEvict, addAndEvict, evict, getStatspublic void add(E element)
Evictorelement - The added element.public Iterator<E> evict(com.google.common.base.Predicate<E> retain)
Evictorretain returns true.retain - A Predicate that is true for elements that
should be retained.public int getN()
public int getCapacity(int index)
public int setCapacity(int index,
int capacity)
public static NQEvictor.Builder builder()
Copyright © 2011–2024 Live Ontologies Project. All rights reserved.