 
     public func invalidateCache() {
         responseCache.invalidate(self)
-        assertHandlers.removeValue(forKey: cacheKey)
+        assertHandlerCache.invalidate(self)
         structureCache.invalidate(self)
         syntaxMapCache.invalidate(self)
         syntaxTokensByLinesCache.invalidate(self)

    internal static func clearCaches() {
        queueForRebuild.clear()
        responseCache.clear()
        assertHandlers.removeAll(keepingCapacity: false)
        structureCache.clear()
        syntaxMapCache.clear()
        syntaxTokensByLinesCache.clear()

internal typealias AssertHandler = () -> Void

private var assertHandlers = [String: AssertHandler]()
private var assertHandlerCache = Cache({ file in assertHandlers[file.cacheKey] })

private struct RebuildQueue {
    private let lock = NSLock()
