void lru_touch(lru_t *lru, lru_item_t *item) { if (item->ttl > 0) { item->touched_at = time(NULL); } d_list_remove(lru->list, item->node); d_list_push(lru->list, item->node); }
/** removes tail of the list. * * performs call of #d_list_remove with _position = LIST_ROOT#count * * @param _root root node of the list * * @return #true if removed successfully \n * #false otherwise (see logs for details in this case) * * @see d_list_remove */ bool d_list_remove_tail(LIST_ROOT* _root) { /* #ifdef _DEBUG */ /* L_DEBUG( "0x%08x\n", _root ); */ /* #endif */ if ( !_root ) { L_ERROR( "_root == NULL\n", "" ); return false; } return d_list_remove(_root, _root->count-1); }
void lru_remove_and_destroy(lru_t *lru, lru_item_t *item) { d_list_remove(lru->list, item->node); d_node_destroy(item->node); lru_destroy_item(item); }