public class LRUCache
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
LRUCache.LRUNode
Interface for nodes in the LRU cache, basicly nodes in a doubly
linked list.
|
static interface |
LRUCache.LRUObj
Interface for object participating in the LRU Cache.
|
Modifier and Type | Field and Description |
---|---|
private DoublyLinkedList |
free |
private int |
maxSize |
private DoublyLinkedList |
used |
Constructor and Description |
---|
LRUCache(int size) |
Modifier and Type | Method and Description |
---|---|
void |
add(LRUCache.LRUObj obj) |
void |
flush() |
int |
getUsed() |
protected void |
print() |
void |
remove(LRUCache.LRUObj obj) |
void |
setSize(int newSz) |
void |
touch(LRUCache.LRUObj obj) |
private DoublyLinkedList free
private DoublyLinkedList used
private int maxSize
public int getUsed()
public void setSize(int newSz)
public void flush()
public void remove(LRUCache.LRUObj obj)
public void touch(LRUCache.LRUObj obj)
public void add(LRUCache.LRUObj obj)
protected void print()