Hybrid ICN (hICN) plugin  v21.06-rc0-4-g18fa668
Typedefs | Functions
listLRU.h File Reference

Maintains an LRU for the content store. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct list_lru_entry ListLruEntry
 
typedef struct list_lru ListLru
 

Functions

void listLRU_EntryDestroy (ListLruEntry **entryPtr)
 
void listLRU_EntryMoveToHead (ListLruEntry *entry)
 
void * listLRU_EntryGetData (ListLruEntry *entry)
 
ListLru * listLRU_Create ()
 
void listLRU_Destroy (ListLru **listPtr)
 
size_t listLRU_Length (const ListLru *lru)
 
ListLruEntry * listLRU_NewHeadEntry (ListLru *lru, void *data)
 
ListLruEntry * listLRU_PopTail (ListLru *list)
 

Detailed Description

Maintains an LRU for the content store.

An LRU list is make up of LRU entries. The entries are bound to the list. The user of the list is reponsible for knowing when there's too many things and wants to remove one. The LRU list will grow without bound otherwise.

The LRU list is meant to be used as an auxiliary data structure, not the primary storage of data elements.

Function Documentation

◆ listLRU_Create()

ListLru* listLRU_Create ( )

@function listLRU_Create @abstract Creates a new Least-Recently-Used list

◆ listLRU_Destroy()

void listLRU_Destroy ( ListLru **  listPtr)

@function listLRU_Destroy @abstract Destroys a list and frees all the elements in it

◆ listLRU_EntryDestroy()

void listLRU_EntryDestroy ( ListLruEntry **  entryPtr)

@function lruEntry_Destroy @abstract Destroys and element. This will also remove it from the list.

◆ listLRU_EntryGetData()

void* listLRU_EntryGetData ( ListLruEntry *  entry)

@function lruEntry_GetData @abstract Returns the user-supplied opaque data when the entry was created

◆ listLRU_EntryMoveToHead()

void listLRU_EntryMoveToHead ( ListLruEntry *  entry)

@function listLRU_EntryMoveToHead @abstract move an element to head

◆ listLRU_Length()

size_t listLRU_Length ( const ListLru *  lru)

Returns the number of items in the list

Parameters
[in]lruAn allocated ListLru
Return values
numberThe number of items in the LRU list

◆ listLRU_NewHeadEntry()

ListLruEntry* listLRU_NewHeadEntry ( ListLru *  lru,
void *  data 
)

@function listLRU_NewHeadEntry @abstract Creates a new entry for the list. It is inserted at the head of the list.

◆ listLRU_PopTail()

ListLruEntry* listLRU_PopTail ( ListLru *  list)

@function listLRU_PopTail @abstract Removes the tail element from the list and returns it to the user @discussion Pops the tail element. The user should examine its data to destroy their tail object, then call LruEntry_Destroy() to free the LRU entry.

Returns
The tail element, or NULL for an empty list