Skip to content

TCache.Add

Add a data element to the list.

Declaration

Source position: cachecls.pp line 87

public 
function TCache.Add(AData: Pointer) : Integer;

Description

Add checks whether AData is already in the list. If so, the item is added to the top of the MRU list. If the item is not yet in the list, then the item is added to the list and placed at the top of the MRU list using the AddNew call.

The function returns the index at which the item was added.

If the maximum number of slots is reached, and a new item is being added, the least used item is dropped from the list.

See also

Name Description
TCache.AddNew Add a new item to the list.
TCache.FindSlot Find data pointer in the list.
TCache.IndexOf Return index of a data pointer in the list.
TCache.Data Indexed access to data items.
TCache.MRUSlot Most recent item slot.