 public final class Cache: Caching {
     // We don't use `NSCache` because it's not LRU
 
-    private var map = [AnyHashable: Node<CachedImage>]()
+    private var map = [AnyHashable: LinkedList<CachedImage>.Node]()
     private let list = LinkedList<CachedImage>()
     private let lock = Lock()
 

            defer { lock.unlock() }

            if let image = newValue {
                add(node: Node(value: CachedImage(image: image, cost: cost(image), key: key)))
                trim()
            } else {
                guard let node = map[key] else { return }

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

    deinit { removeAll() }

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