Object - cache : LruEvictionPolicy

The cache:LruEvictionPolicy object consists of the LRU eviction algorithm related operations based on a linked list data structure.

Methods

Updates the linked list based on the get operation related to the LRU eviction algorithm.

Updates the linked list based on the put operation related to the LRU eviction algorithm.

Updates the linked list based on the remove operation related to the LRU eviction algorithm.

Updates the linked list based on the replace operation related to the LRU eviction algorithm.

Updates the linked list based on the clear operation related to the LRU eviction algorithm.

Updates the linked list based on the evict operation.

get

Updates the linked list based on the get operation related to the LRU eviction algorithm.

Parameters

  • list LinkedList
  • Linked list data structure, which is used to govern the eviction policy

  • node Node
  • Node of the linked list, which is retrieved

put

Updates the linked list based on the put operation related to the LRU eviction algorithm.

Parameters

  • list LinkedList
  • Linked list data structure, which is used to govern the eviction policy

  • node Node
  • Node of the linked list, which is added newly

remove

Updates the linked list based on the remove operation related to the LRU eviction algorithm.

Parameters

  • list LinkedList
  • Linked list data structure, which is used to govern the eviction policy

  • node Node
  • Node of the linked list, which is deleted

replace

Updates the linked list based on the replace operation related to the LRU eviction algorithm.

Parameters

  • list LinkedList
  • Linked list data structure, which is used to govern the eviction policy

  • newNode Node
  • Node of the linked list, which will be replacing the oldNode

  • oldNode Node
  • Node of the linked list, which will be replaced by the newNode

clear

Updates the linked list based on the clear operation related to the LRU eviction algorithm.

Parameters

  • list LinkedList
  • Linked list data structure, which is used to govern the eviction policy

evict

(LinkedList list)

returns Node?

Updates the linked list based on the evict operation.

Parameters

  • list LinkedList
  • Linked list data structure, which is used to govern the eviction policy

  • Return Type

    (Node?)
  • The Node, which is evicted from the linked list or () if nothing to be evicted