Skip to content

Commit 62334c0

Browse files
author
Wang Lun
committed
revert cache strategy
1 parent dd7de19 commit 62334c0

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

Sources/SourceKitLSP/Swift/GeneratedInterfaceManager.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,7 @@ actor GeneratedInterfaceManager {
9292
incrementingRefCount: Bool
9393
) async throws -> OpenGeneratedInterfaceDocumentDetails {
9494
func loadFromCache() -> OpenGeneratedInterfaceDocumentDetails? {
95-
// Cache by module name and group name, not the full document data
96-
// This allows reuse across different buildSettingsFrom URIs
97-
guard let cachedIndex = openInterfaces.firstIndex(where: {
98-
$0.url.moduleName == document.moduleName &&
99-
$0.url.groupName == document.groupName &&
100-
$0.url.sourcekitdDocumentName == document.sourcekitdDocumentName
101-
}) else {
95+
guard let cachedIndex = openInterfaces.firstIndex(where: { $0.url == document }) else {
10296
return nil
10397
}
10498
if incrementingRefCount {
@@ -166,11 +160,7 @@ actor GeneratedInterfaceManager {
166160
}
167161

168162
private func decrementRefCount(for document: GeneratedInterfaceDocumentURLData) {
169-
guard let cachedIndex = openInterfaces.firstIndex(where: {
170-
$0.url.moduleName == document.moduleName &&
171-
$0.url.groupName == document.groupName &&
172-
$0.url.sourcekitdDocumentName == document.sourcekitdDocumentName
173-
}) else {
163+
guard let cachedIndex = openInterfaces.firstIndex(where: { $0.url == document }) else {
174164
logger.fault(
175165
"Generated interface document for \(document.moduleName) is not open anymore. Unbalanced retain and releases?"
176166
)

0 commit comments

Comments
 (0)