Class IntrusiveSoftLRU.Node.Adapter<T extends IntrusiveSoftLRU.Node<T>>
java.lang.Object
com.illumon.util.datastructures.intrusive.IntrusiveSoftLRU.Node.Adapter<T>
- Type Parameters:
T
-
- All Implemented Interfaces:
IntrusiveSoftLRU.Adapter<T>
- Enclosing interface:
- IntrusiveSoftLRU.Node<T extends IntrusiveSoftLRU.Node<T>>
public static class IntrusiveSoftLRU.Node.Adapter<T extends IntrusiveSoftLRU.Node<T>> extends Object implements IntrusiveSoftLRU.Adapter<T>
A basic adapter class for
IntrusiveSoftLRU.Node
items in the cache.-
Constructor Summary
Constructors Constructor Description Adapter()
-
Method Summary
Modifier and Type Method Description static <T extends IntrusiveSoftLRU.Node<T>>
IntrusiveSoftLRU.Adapter<T>getInstance()
SoftReference<T>
getOwner(T cachedObject)
Get theSoftReference
object which owns the object being cached.int
getSlot(T cachedObject)
Get the slot in which the reference is stored in the cache.void
setSlot(T cachedObject, int slot)
Set the slot in which the reference is stored in the cache.
-
Constructor Details
-
Adapter
public Adapter()
-
-
Method Details
-
getInstance
-
getOwner
Description copied from interface:IntrusiveSoftLRU.Adapter
Get theSoftReference
object which owns the object being cached.- Specified by:
getOwner
in interfaceIntrusiveSoftLRU.Adapter<T extends IntrusiveSoftLRU.Node<T>>
- Parameters:
cachedObject
- the object being cached.- Returns:
- the
SoftReference
that owns the item.
-
getSlot
Description copied from interface:IntrusiveSoftLRU.Adapter
Get the slot in which the reference is stored in the cache.- Specified by:
getSlot
in interfaceIntrusiveSoftLRU.Adapter<T extends IntrusiveSoftLRU.Node<T>>
- Parameters:
cachedObject
- the being cached.- Returns:
- the slot for the object.
-
setSlot
Description copied from interface:IntrusiveSoftLRU.Adapter
Set the slot in which the reference is stored in the cache.- Specified by:
setSlot
in interfaceIntrusiveSoftLRU.Adapter<T extends IntrusiveSoftLRU.Node<T>>
- Parameters:
cachedObject
- the object being cached.slot
- the slot where it will be stored.
-