示例#1
0
 /// <summary>
 /// Attempts to get a SessionVector by ID.  If it doesn't exist then there's a chance that
 /// we're out-of-sync.  So go to the cluster and look for a session by that ID.  If one
 /// exists then start a local session with that ID and the details stored in the cluster.
 /// </summary>
 /// <param name="sessionId"></param>
 /// <returns></returns>
 public Option <SessionVector> GetSession(SessionId sessionId) =>
 Sync.GetSession(sessionId).IfNone(() =>
                                   Sync.GetSession(from c in cluster
                                                   from ts in c.GetHashField <long>(SessionKey(sessionId), LastAccessKey)
                                                   from to in c.GetHashField <int>(SessionKey(sessionId), TimeoutKey)
                                                   select Sync.Start(sessionId, to, LoadData(sessionId)))
                                   .IfNone(() => failwith <SessionVector>("Session doesn't exist")));
示例#2
0
 /// <summary>
 /// Attempts to get a SessionVector by ID.  If it doesn't exist then there's a chance that
 /// we're out-of-sync.  So go to the cluster and look for a session by that ID.  If one
 /// exists then start a local session with that ID and the details stored in the cluster.
 /// </summary>
 /// <param name="sessionId"></param>
 /// <returns></returns>
 public Option <SessionVector> GetSession(SessionId sessionId) =>
 Sync.GetSession(sessionId) || Sync.GetSession(from c in cluster
                                               from to in c.GetHashField <int>(SessionKey(sessionId), TimeoutKey)
                                               select Sync.Start(sessionId, to));