mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2026-11-29 08:42:51 +00:00
Handle low memory notification.
This commit is contained in:
1 parent
2d5829f934
commit
d2d85a83e5
1 file changed
+6
@@ -43,6 +43,8 @@ final class ArticlesTable: DatabaseTable, Sendable {
|
||||
|
||||
self.searchTable = SearchTable(queue: queue)
|
||||
self.searchTable.articlesTable = self
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(handleLowMemory(_:)), name: .lowMemory, object: nil)
|
||||
}
|
||||
|
||||
// MARK: - Fetching Articles for Feed
|
||||
@@ -588,6 +590,10 @@ final class ArticlesTable: DatabaseTable, Sendable {
|
||||
|
||||
// MARK: - Caches
|
||||
|
||||
@objc func handleLowMemory(_ notification: Notification) {
|
||||
emptyCaches()
|
||||
}
|
||||
|
||||
func emptyCaches() {
|
||||
queue.runInDatabase { _ in
|
||||
self.articlesCache.withLock { $0 = [String: Article]() }
|
||||
|
||||
Reference in new issue
Block a user