nostrdb: add profiles to nostrdb
This adds profiles to nostrdb - Remove in-memory Profiles caches, nostrdb is as fast as an in-memory cache - Remove ProfileDatabase and just use nostrdb directly Changelog-Changed: Use nostrdb for profiles
This commit is contained in:
@@ -137,6 +137,7 @@ class EventData {
|
||||
}
|
||||
|
||||
class EventCache {
|
||||
private let ndb: Ndb
|
||||
private var events: [NoteId: NostrEvent] = [:]
|
||||
private var replies = ReplyMap()
|
||||
private var cancellable: AnyCancellable?
|
||||
@@ -145,7 +146,8 @@ class EventCache {
|
||||
|
||||
//private var thread_latest: [String: Int64]
|
||||
|
||||
init() {
|
||||
init(ndb: Ndb) {
|
||||
self.ndb = ndb
|
||||
cancellable = NotificationCenter.default.publisher(
|
||||
for: UIApplication.didReceiveMemoryWarningNotification
|
||||
).sink { [weak self] _ in
|
||||
@@ -250,7 +252,11 @@ class EventCache {
|
||||
insert(ev)
|
||||
return ev
|
||||
}
|
||||
|
||||
|
||||
func lookup_by_key(_ key: UInt64) -> NostrEvent? {
|
||||
ndb.lookup_note_by_key(key)
|
||||
}
|
||||
|
||||
func lookup(_ evid: NoteId) -> NostrEvent? {
|
||||
return events[evid]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user