Each cache entry has links to and from the next entry in the list, this structure is used as it allows very efficient removal of an entry without actually searching the entire list. The head and tail of the list are marked using sentinels. This structure is used instead of using the first and last entry respectively as it simplifies removal and insertion code at the slight expense of iterating. As the former operations are performed far more often than the latter this seems a reasonable trade to make.
|
|