[Overview][Resource strings][Types][Classes][Index] | Reference for unit 'CacheCls' (#fcl)

# TCache.Add

Add a data element to the list.

## Declaration

Source position: cachecls.pp line 81

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

## Arguments

`AData` |  | Data pointer to add to the cache.

## Function result

Index at which item was added.

## 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

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.

Documentation generated on: Feb 26 2014