Redis
This extends Request.Redis with a bunch of function wrappers that (mostly) make a single Redis call. The function names describe what the functions do in Swiftarr API terms, keeping the Redis keys and specific commands used internal to this file. When looking at the Redis database you can refer to this file to see what various keys are used for, and having all the Redis code here makes it much easier to reason about changes to how we structure data in Redis.
Unlike Postgres with Fluent, Redis doesn’t provide us with a centralized data model for how the db is structured. Having code all over the app call hset directly makes it difficult to answer questions like, “What fields should exist in this hash set?” So, all that is centralized here.
-
addUsersWithStateChange(_:
Asynchronous) Declaration
Swift
func addUsersWithStateChange(_ userIDs: [UUID]) async throws
-
testAndClearStateChange(_:
Asynchronous) Declaration
Swift
func testAndClearStateChange(_ userID: UUID) async throws -> Bool
-
Declaration
Swift
func userHashRedisKey(userID: UUID) -> RedisKey
-
getUserHash(userID:
Asynchronous) Declaration
Swift
func getUserHash(userID: UUID) async throws -> [String : RESPValue]
-
Declaration
Swift
func getIntFromUserHash(_ hash: [String : RESPValue], field: NotificationType, viewed: Bool = false) -> Int
-
Declaration
Swift
func getUUIDFromUserHash(_ hash: [String : RESPValue], field: NotificationType) -> UUID?
-
Declaration
Swift
func getNextEventFromUserHash(_ hash: [String : RESPValue]) -> (Date, UUID)?
-
Declaration
Swift
func getNextLFGFromUserHash(_ hash: [String : RESPValue]) -> (Date, UUID)?
-
markAllViewedInUserHash(field:
AsynchronoususerID: ) Declaration
Swift
func markAllViewedInUserHash(field: NotificationType, userID: UUID) async throws
-
setIntInUserHash(to:
Asynchronousfield: userID: ) Declaration
Swift
func setIntInUserHash(to value: Int, field: NotificationType, userID: UUID) async throws
-
incrementIntInUserHash(field:
AsynchronoususerID: incAmount: ) Declaration
Swift
func incrementIntInUserHash(field: NotificationType, userID: UUID, incAmount: Int = 1) async throws
-
Declaration
Swift
func incrementAlertwordTwarrtInUserHash(word: String, userID: UUID, incAmount: Int = 1) async throws
-
Declaration
Swift
func incrementAlertwordPostInUserHash(word: String, userID: UUID, incAmount: Int = 1) async throws
-
setNextEventInUserHash(date:
AsynchronouseventID: userID: ) Declaration
Swift
func setNextEventInUserHash(date: Date?, eventID: UUID?, userID: UUID) async throws
-
setNextLFGInUserHash(date:
AsynchronouslfgID: userID: ) Declaration
Swift
func setNextLFGInUserHash(date: Date?, lfgID: UUID?, userID: UUID) async throws
-
Declaration
Swift
static let hashtagsRedisKey: <<error type>>
-
getHashtags(matching:
Asynchronous) Declaration
Swift
func getHashtags(matching: String) async throws -> [String]
-
addHashtags(_:
Asynchronous) Declaration
Swift
func addHashtags(_ hashtags: Set<String>) async throws
-
Declaration
Swift
static let alertwordsRedisKey: <<error type>>
-
Declaration
Swift
func getAlertwordUsersRedisKey(_ word: String) -> RedisKey
-
getAllAlertwords()
AsynchronousDeclaration
Swift
func getAllAlertwords() async throws -> Set<String>
-
addAlertword(_:
AsynchronoususerID: ) Declaration
Swift
func addAlertword(_ word: String, userID: UUID) async throws
-
removeAlertword(_:
Asynchronous) Declaration
Swift
func removeAlertword(_ word: String) async throws
-
removeUserAlertword(_:
AsynchronoususerID: ) Declaration
Swift
func removeUserAlertword(_ word: String, userID: UUID) async throws
-
getUsersForAlertword(_:
Asynchronous) Declaration
Swift
func getUsersForAlertword(_ word: String) async throws -> [UUID]
-
Declaration
Swift
static let activeAnnouncementRedisKey: <<error type>>
-
getActiveAnnouncementIDs()
AsynchronousDeclaration
Swift
func getActiveAnnouncementIDs() async throws -> [Int]?
-
setActiveAnnouncementIDs(_:
Asynchronous) Declaration
Swift
func setActiveAnnouncementIDs(_ ids: [Int]) async throws
-
resetActiveAnnouncementIDs()
AsynchronousDeclaration
Swift
func resetActiveAnnouncementIDs() async throws
-
Declaration
Swift
enum MailInbox
-
Declaration
Swift
func unreadMailRedisKey(_ userID: UUID, inbox: MailInbox) -> RedisKey
-
getSeamailUnreadCounts(userID:
Asynchronousinbox: ) Declaration
Swift
func getSeamailUnreadCounts(userID: UUID, inbox: MailInbox) async throws -> Int
-
markSeamailRead(type:
Asynchronousin: userID: ) Declaration
Swift
func markSeamailRead(type: NotificationType, in inbox: MailInbox, userID: UUID) async throws
-
newUnreadMessage(msgID:
AsynchronoususerID: inbox: ) Declaration
Swift
func newUnreadMessage(msgID: UUID, userID: UUID, inbox: MailInbox) async throws
-
deletedUnreadMessage(msgID:
AsynchronoususerID: inbox: ) Declaration
Swift
func deletedUnreadMessage(msgID: UUID, userID: UUID, inbox: MailInbox) async throws
-
markLFGDeleted(msgID:
AsynchronoususerID: ) Declaration
Swift
func markLFGDeleted(msgID: UUID, userID: UUID) async throws
-
addBlockedUsers(_:
AsynchronousblockedBy: ) Declaration
Swift
func addBlockedUsers(_ blockedUsers: [UUID], blockedBy requester: UUID) async throws
-
removeBlockedUsers(_:
AsynchronousblockedBy: ) Declaration
Swift
func removeBlockedUsers(_ blockedUsers: [UUID], blockedBy requester: UUID) async throws
-
getBlocks(for:
Asynchronous) Declaration
Swift
func getBlocks(for userUUID: UUID) async throws -> [UUID]
-
storeSessionMarker(_:
Asynchronousmarker: forUserID: ) Declaration
Swift
func storeSessionMarker(_ session: SessionID?, marker: String, forUserID: UUID) async throws
-
clearSessionMarker(_:
AsynchronousforUserID: ) Declaration
Swift
func clearSessionMarker(_ session: SessionID?, forUserID: UUID) async throws
-
clearAllSessionMarkers(forUserID:
Asynchronous) Declaration
Swift
func clearAllSessionMarkers(forUserID: UUID) async throws
-
getUserSessions(_:
Asynchronous) Declaration
Swift
func getUserSessions(_ userID: UUID) async throws -> [String : String]