Merge branch 'master' into user-cache

This commit is contained in:
Bryan Montz
2023-05-26 06:46:47 -05:00
85 changed files with 2379 additions and 299 deletions

View File

@@ -17,7 +17,7 @@ class Profiles {
qos: .userInteractive,
attributes: .concurrent)
var profiles: [String: TimestampedProfile] = [:]
private var profiles: [String: TimestampedProfile] = [:]
var validated: [String: NIP05] = [:]
var nip05_pubkey: [String: String] = [:]
var zappers: [String: String] = [:]
@@ -28,6 +28,12 @@ class Profiles {
validated[pk]
}
func enumerated() -> EnumeratedSequence<[String: TimestampedProfile]> {
return queue.sync {
return profiles.enumerated()
}
}
func lookup_zapper(pubkey: String) -> String? {
zappers[pubkey]
}
@@ -77,3 +83,9 @@ class Profiles {
return Date.now.timeIntervalSince(pull_date) < Profiles.db_freshness_threshold
}
}
func invalidate_zapper_cache(pubkey: String, profiles: Profiles, lnurl: LNUrls) {
profiles.zappers.removeValue(forKey: pubkey)
lnurl.endpoints.removeValue(forKey: pubkey)
}