DistributedSessionStore.Create 方法

定义

重载

Create(String, TimeSpan, Func<Boolean>, Boolean)
Create(String, TimeSpan, TimeSpan, Func<Boolean>, Boolean)

创建新的 或恢复 ISession

Create(String, TimeSpan, Func<Boolean>, Boolean)

public:
 virtual Microsoft::AspNetCore::Http::ISession ^ Create(System::String ^ sessionKey, TimeSpan idleTimeout, Func<bool> ^ tryEstablishSession, bool isNewSessionKey);
public Microsoft.AspNetCore.Http.ISession Create (string sessionKey, TimeSpan idleTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey);
abstract member Create : string * TimeSpan * Func<bool> * bool -> Microsoft.AspNetCore.Http.ISession
override this.Create : string * TimeSpan * Func<bool> * bool -> Microsoft.AspNetCore.Http.ISession
Public Function Create (sessionKey As String, idleTimeout As TimeSpan, tryEstablishSession As Func(Of Boolean), isNewSessionKey As Boolean) As ISession

参数

sessionKey
String
idleTimeout
TimeSpan
tryEstablishSession
Func<Boolean>
isNewSessionKey
Boolean

返回

实现

适用于

Create(String, TimeSpan, TimeSpan, Func<Boolean>, Boolean)

Source:
DistributedSessionStore.cs
Source:
DistributedSessionStore.cs
Source:
DistributedSessionStore.cs

创建新的 或恢复 ISession

public:
 virtual Microsoft::AspNetCore::Http::ISession ^ Create(System::String ^ sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> ^ tryEstablishSession, bool isNewSessionKey);
public Microsoft.AspNetCore.Http.ISession Create (string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey);
abstract member Create : string * TimeSpan * TimeSpan * Func<bool> * bool -> Microsoft.AspNetCore.Http.ISession
override this.Create : string * TimeSpan * TimeSpan * Func<bool> * bool -> Microsoft.AspNetCore.Http.ISession
Public Function Create (sessionKey As String, idleTimeout As TimeSpan, ioTimeout As TimeSpan, tryEstablishSession As Func(Of Boolean), isNewSessionKey As Boolean) As ISession

参数

sessionKey
String

用于查找会话的唯一键。

idleTimeout
TimeSpan

会话可以处于非活动状态 (多长时间,例如在会话过期之前未访问) 。

ioTimeout
TimeSpan

和 允许使用的最大时间LoadAsync(CancellationToken)CommitAsync(CancellationToken)量。

tryEstablishSession
Func<Boolean>

期间 Set(String, Byte[]) 调用的回调,用于验证修改会话当前是否有效。 如果回调返回 falseSet(String, Byte[]) 则应引发 InvalidOperationExceptionSessionMiddleware 提供一个回调,如果在发送响应之前未建立会话,则返回 false 该回调。

isNewSessionKey
Boolean

true 如果建立新会话,则为 ; false 如果恢复会话,则为 。

返回

ISession已创建或恢复的 。

实现

适用于