This commit is contained in:
Gwendal Roué committed 2022-01-30 14:41:29 +01:00
1 parent b82f92f726
commit 4e65425c00
2 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -639,7 +639,7 @@ struct StatementCache {
statements.removeFirst { $0.value === statement }
}
mutating func clear(where isDeleted: (Statement) -> Bool) {
statements = statements.filter { (_, statement) in !isDeleted(statement) }
mutating func removeAll(where shouldBeRemoved: (Statement) -> Bool) {
statements = statements.filter { (_, statement) in !shouldBeRemoved(statement) }
}
}
+4 -4
View File
@@ -17,8 +17,8 @@ extension Database {
// Drop cached statements that delete, this the addition of an
// observer may change the need for truncate optimization prevention.
publicStatementCache.clear(where: { $0.databaseEventKinds.contains(where: \.isDelete) })
internalStatementCache.clear(where: { $0.databaseEventKinds.contains(where: \.isDelete) })
publicStatementCache.removeAll { $0.databaseEventKinds.contains(where: \.isDelete) }
internalStatementCache.removeAll{ $0.databaseEventKinds.contains(where: \.isDelete) }
observationBroker.add(transactionObserver: transactionObserver, extent: extent)
}
@@ -29,8 +29,8 @@ extension Database {
// Drop cached statements that delete, this the removal of an
// observer may change the need for truncate optimization prevention.
publicStatementCache.clear(where: { $0.databaseEventKinds.contains(where: \.isDelete) })
internalStatementCache.clear(where: { $0.databaseEventKinds.contains(where: \.isDelete) })
publicStatementCache.removeAll { $0.databaseEventKinds.contains(where: \.isDelete) }
internalStatementCache.removeAll { $0.databaseEventKinds.contains(where: \.isDelete) }
observationBroker.remove(transactionObserver: transactionObserver)
}