         }
     }
 
-    private func add(node: Node<CachedImage>) {
+    private func add(node: LinkedList<CachedImage>.Node) {
         if let existingNode = map[node.value.key] {
             remove(node: existingNode)
         }

/// Basic doubly linked list.
private final class LinkedList<V> {
    // head <-> node <-> ... <-> tail
    private(set) var head: Node<V>?
    private(set) var tail: Node<V>?

    deinit { removeAll() }

    /// Appends node to the head.
    func append(_ node: Node<V>) {
        if let currentHead = head {
            head = node
            currentHead.previous = node

        }
    }

    func remove(_ node: Node) {
        node.next?.previous = node.previous // node.previous is nil if node=head
        node.previous?.next = node.next // node.next is nil if node=tail
        if node === head { head = node.next }
