/// <summary> /// Asserts that the current session ID is valid /// Checks the cached state first. If the session has expired locally it /// then checks to see if it's been updated remotely. Otherwise it throws. /// </summary> /// <returns></returns> public static Unit AssertSession() => SessionId.IfSome(sid => SessionManagerProcess.GetSession(sessions.Sessions, sid).IfNone(() => { SessionManager.Stop(sid); // Make sure it's gone SessionId = None; throw new ProcessSessionExpired(); }));
/// <summary> /// Get session meta data /// </summary> public static Option <T> GetSessionData <T>(string sid) => SessionManagerProcess.GetSessionMetadata <T>(sessions, sid);