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) DeclarationSwift func addUsersWithStateChange(_ userIDs: [UUID]) async throws
- 
                  testAndClearStateChange(_:Asynchronous) DeclarationSwift func testAndClearStateChange(_ userID: UUID) async throws -> Bool
- 
                  
                  DeclarationSwift func userHashRedisKey(userID: UUID) -> RedisKey
- 
                  getUserHash(userID:Asynchronous) DeclarationSwift func getUserHash(userID: UUID) async throws -> [String : RESPValue]
- 
                  
                  DeclarationSwift func getIntFromUserHash(_ hash: [String : RESPValue], field: NotificationType, viewed: Bool = false) -> Int
- 
                  
                  DeclarationSwift func getUUIDFromUserHash(_ hash: [String : RESPValue], field: NotificationType) -> UUID?
- 
                  
                  DeclarationSwift func getNextEventFromUserHash(_ hash: [String : RESPValue]) -> (Date, UUID)?
- 
                  
                  DeclarationSwift func getNextLFGFromUserHash(_ hash: [String : RESPValue]) -> (Date, UUID)?
- 
                  markAllViewedInUserHash(field:AsynchronoususerID: ) DeclarationSwift func markAllViewedInUserHash(field: NotificationType, userID: UUID) async throws
- 
                  setIntInUserHash(to:Asynchronousfield: userID: ) DeclarationSwift func setIntInUserHash(to value: Int, field: NotificationType, userID: UUID) async throws
- 
                  incrementIntInUserHash(field:AsynchronoususerID: incAmount: ) DeclarationSwift func incrementIntInUserHash(field: NotificationType, userID: UUID, incAmount: Int = 1) async throws
- 
                  
                  DeclarationSwift func incrementAlertwordTwarrtInUserHash(word: String, userID: UUID, incAmount: Int = 1) async throws
- 
                  
                  DeclarationSwift func incrementAlertwordPostInUserHash(word: String, userID: UUID, incAmount: Int = 1) async throws
- 
                  setNextEventInUserHash(date:AsynchronouseventID: userID: ) DeclarationSwift func setNextEventInUserHash(date: Date?, eventID: UUID?, userID: UUID) async throws
- 
                  setNextLFGInUserHash(date:AsynchronouslfgID: userID: ) DeclarationSwift func setNextLFGInUserHash(date: Date?, lfgID: UUID?, userID: UUID) async throws
- 
                  
                  DeclarationSwift static let hashtagsRedisKey: <<error type>>
- 
                  getHashtags(matching:Asynchronous) DeclarationSwift func getHashtags(matching: String) async throws -> [String]
- 
                  addHashtags(_:Asynchronous) DeclarationSwift func addHashtags(_ hashtags: Set<String>) async throws
- 
                  
                  DeclarationSwift static let alertwordsRedisKey: <<error type>>
- 
                  
                  DeclarationSwift func getAlertwordUsersRedisKey(_ word: String) -> RedisKey
- 
                  getAllAlertwords()AsynchronousDeclarationSwift func getAllAlertwords() async throws -> Set<String>
- 
                  addAlertword(_:AsynchronoususerID: ) DeclarationSwift func addAlertword(_ word: String, userID: UUID) async throws
- 
                  removeAlertword(_:Asynchronous) DeclarationSwift func removeAlertword(_ word: String) async throws
- 
                  removeUserAlertword(_:AsynchronoususerID: ) DeclarationSwift func removeUserAlertword(_ word: String, userID: UUID) async throws
- 
                  getUsersForAlertword(_:Asynchronous) DeclarationSwift func getUsersForAlertword(_ word: String) async throws -> [UUID]
- 
                  
                  DeclarationSwift static let activeAnnouncementRedisKey: <<error type>>
- 
                  getActiveAnnouncementIDs()AsynchronousDeclarationSwift func getActiveAnnouncementIDs() async throws -> [Int]?
- 
                  setActiveAnnouncementIDs(_:Asynchronous) DeclarationSwift func setActiveAnnouncementIDs(_ ids: [Int]) async throws
- 
                  resetActiveAnnouncementIDs()AsynchronousDeclarationSwift func resetActiveAnnouncementIDs() async throws
- 
                  
                  DeclarationSwift enum MailInbox
- 
                  
                  DeclarationSwift func unreadMailRedisKey(_ userID: UUID, inbox: MailInbox) -> RedisKey
- 
                  getSeamailUnreadCounts(userID:Asynchronousinbox: ) DeclarationSwift func getSeamailUnreadCounts(userID: UUID, inbox: MailInbox) async throws -> Int
- 
                  markSeamailRead(type:Asynchronousin: userID: ) DeclarationSwift func markSeamailRead(type: NotificationType, in inbox: MailInbox, userID: UUID) async throws
- 
                  newUnreadMessage(msgID:AsynchronoususerID: inbox: ) DeclarationSwift func newUnreadMessage(msgID: UUID, userID: UUID, inbox: MailInbox) async throws
- 
                  deletedUnreadMessage(msgID:AsynchronoususerID: inbox: ) DeclarationSwift func deletedUnreadMessage(msgID: UUID, userID: UUID, inbox: MailInbox) async throws
- 
                  markLFGDeleted(msgID:AsynchronoususerID: ) DeclarationSwift func markLFGDeleted(msgID: UUID, userID: UUID) async throws
- 
                  addBlockedUsers(_:AsynchronousblockedBy: ) DeclarationSwift func addBlockedUsers(_ blockedUsers: [UUID], blockedBy requester: UUID) async throws
- 
                  removeBlockedUsers(_:AsynchronousblockedBy: ) DeclarationSwift func removeBlockedUsers(_ blockedUsers: [UUID], blockedBy requester: UUID) async throws
- 
                  getBlocks(for:Asynchronous) DeclarationSwift func getBlocks(for userUUID: UUID) async throws -> [UUID]
- 
                  storeSessionMarker(_:Asynchronousmarker: forUserID: ) DeclarationSwift func storeSessionMarker(_ session: SessionID?, marker: String, forUserID: UUID) async throws
- 
                  clearSessionMarker(_:AsynchronousforUserID: ) DeclarationSwift func clearSessionMarker(_ session: SessionID?, forUserID: UUID) async throws
- 
                  clearAllSessionMarkers(forUserID:Asynchronous) DeclarationSwift func clearAllSessionMarkers(forUserID: UUID) async throws
- 
                  getUserSessions(_:Asynchronous) DeclarationSwift func getUserSessions(_ userID: UUID) async throws -> [String : String]
 View on GitHub
            View on GitHub
           Redis Extension Reference
      Redis Extension Reference