語言

DistributedSession 類別

定義

public ref class DistributedSession : Microsoft::AspNetCore::Http::ISession
public class DistributedSession : Microsoft.AspNetCore.Http.ISession
type DistributedSession = class
    interface ISession
Public Class DistributedSession
Implements ISession
繼承
DistributedSession
實作

建構函式

名稱 Description
DistributedSession(IDistributedCache, String, TimeSpan, Func<Boolean>, ILoggerFactory, Boolean)

支援的 ISessionIDistributedCache 。

DistributedSession(IDistributedCache, String, TimeSpan, TimeSpan, Func<Boolean>, ILoggerFactory, Boolean)

初始化 DistributedSession 的新執行個體。

屬性

名稱 Description
Id

目前會話的唯一識別碼。 這與會話 Cookie 不同,因為 Cookie 存留期可能與資料存放區中的會話專案存留期不同。

IsAvailable

指出目前會話是否已順利載入。 在載入會話之前存取此屬性會導致內嵌載入它。

Keys

列舉所有索引鍵,如果有的話。

方法

名稱 Description
Clear()

如果有的話,請從目前的會話中移除所有專案。 會話 Cookie 不會移除。

CommitAsync()

支援的 ISessionIDistributedCache 。

CommitAsync(CancellationToken)

將資料存放區中的會話儲存在資料存放區中。 如果資料存放區無法使用,可能會擲回此資料存放區。

LoadAsync()

支援的 ISessionIDistributedCache 。

LoadAsync(CancellationToken)

從資料存放區載入會話。 如果資料存放區無法使用,可能會擲回此資料存放區。

Remove(String)

如果有的話,請從會話中移除指定的金鑰。

Set(String, Byte[])

在目前的會話中設定指定的索引鍵和值。 如果在傳送回應之前未建立會話,這會擲回。

TryGetValue(String, Byte[])

如果有的話,擷取指定索引鍵的值。

擴充方法

名稱 Description
Get(ISession, String)

從 ISession 取得位元組陣列值。

GetInt32(ISession, String)

從 ISession 取得 int 值。

GetString(ISession, String)

從 ISession 取得字串值。

SetInt32(ISession, String, Int32)

在 中設定 int ISession 值。

SetString(ISession, String, String)

String設定 中的 ISession 值。

適用於