// addtail adds the item by searching from the the tail.
addtail adds the item by searching from the the tail.
// addtail adds the item by searching from the the tail .
func (ttl *TTL) addtail(item *Item) {
	var last *Item
	for curr := ttl.tail; curr != nil; curr = curr.prev {
		if curr.timeoutAt.Before(item.timeoutAt) {
			if last == nil {
				ttl.tail = item
			} else {
				item.prev = curr
				item.next = last
				last.prev = item
			}
			item.prev = curr
			curr.next = item
			return
		}
		last = curr
	}
	if last == nil {
		ttl.head = item
		ttl.tail = item
	} else {
		last.prev = item
		item.next = last
		if ttl.head == last {
			ttl.head = item
		}
	}
}
func ( ttl * TTL ) addtail ( item * Item ) { var last * Item for curr := ttl . tail ; curr != nil ; curr = curr . prev { if curr . timeoutAt . Before ( item . timeoutAt ) { if last == nil { ttl . tail = item } else { item . prev = curr item . next = last last . prev = item } item . prev = curr curr . next = item return } last = curr } if last == nil { ttl . head = item ttl . tail = item } else { last . prev = item item . next = last if ttl . head == last { ttl . head = item } } }
addtail adds the item by searching from the the tail.
addtail adds the item by searching from the the tail .