Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.cache
Class LRUCachePolicy.LRUList

    java.lang.Object
      com.knowgate.cache.LRUCachePolicy.LRUList

Enclosing class:
  LRUCachePolicy

    public class LRUCachePolicy.LRUList

extends java.lang.Object

Double queued list used to store cache entries.

Field Summary
`int` | `m_cacheMiss` The cache misses happened
`int` | `m_capacity` The current capacity of the cache list
`int` | `m_count` The number of cached objects
`LRUCachePolicy.LRUCacheEntry` | `m_head` The head of the double linked list
`int` | `m_maxCapacity` The maximum capacity of the cache list
`int` | `m_minCapacity` The minimum capacity of the cache list
`LRUCachePolicy.LRUCacheEntry` | `m_tail` The tail of the double linked list

Constructor Summary
`protected` | `LRUCachePolicy.LRUList()` Creates a new double queued list.

Method Summary
`protected void` | `capacityChanged(int oldCapacity)` Callback that signals that the capacity of the cache is changed.
`protected void` | `clear()`
`protected void` | `demote()` Demotes from the cache the least used entry.
`protected void` | `entryAdded(LRUCachePolicy.LRUCacheEntry entry)` Callback that signals that the given entry has been added to the cache.
`protected void` | `entryRemoved(LRUCachePolicy.LRUCacheEntry entry)` Callback that signals that the given entry has been removed from the cache.
`protected void` | `promote(LRUCachePolicy.LRUCacheEntry entry)` Promotes the cache entry `entry` to the last used position of the list.
`protected void` | `remove(LRUCachePolicy.LRUCacheEntry entry)` Removes from the cache list the specified entry.
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### m_maxCapacity

    public int m_maxCapacity

  The maximum capacity of the cache list

### m_minCapacity

    public int m_minCapacity

  The minimum capacity of the cache list

### m_capacity

    public int m_capacity

  The current capacity of the cache list

### m_count

    public int m_count

  The number of cached objects

### m_head

    public LRUCachePolicy.LRUCacheEntry m_head

  The head of the double linked list

### m_tail

    public LRUCachePolicy.LRUCacheEntry m_tail

  The tail of the double linked list

### m_cacheMiss

    public int m_cacheMiss

  The cache misses happened

Constructor Detail

### LRUCachePolicy.LRUList

    protected LRUCachePolicy.LRUList()

  Creates a new double queued list.

Method Detail

### promote

    protected void promote(LRUCachePolicy.LRUCacheEntry entry)

  Promotes the cache entry `entry` to the last used position of the list.
  If the object is already there, does nothing.

  Parameters:
    `entry` - the object to be promoted, cannot be null
  Throws:
    `java.lang.IllegalStateException` - if this method is called with a full cache
  See Also:
    `demote()`

### demote

    protected void demote()

  Demotes from the cache the least used entry.
  If the cache is not full, does nothing.

  See Also:
    `promote(com.knowgate.cache.LRUCachePolicy.LRUCacheEntry)`

### remove

    protected void remove(LRUCachePolicy.LRUCacheEntry entry)
                   throws java.lang.IllegalArgumentException,
                          java.lang.IllegalStateException

  Removes from the cache list the specified entry.

  Throws:
    `java.lang.IllegalArgumentException`
    `java.lang.IllegalStateException`

### entryAdded

    protected void entryAdded(LRUCachePolicy.LRUCacheEntry entry)

  Callback that signals that the given entry has been added to the cache.

### entryRemoved

    protected void entryRemoved(LRUCachePolicy.LRUCacheEntry entry)

  Callback that signals that the given entry has been removed from the cache.

### capacityChanged

    protected void capacityChanged(int oldCapacity)

  Callback that signals that the capacity of the cache is changed.

  Parameters:
    `oldCapacity` - the capacity before the change happened

### clear

    protected void clear()

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD