Bagikan melalui


DistributedSession Konstruktor

Definisi

Overload

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

Menginisialisasi instans baru .DistributedSession

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

public:
 DistributedSession(Microsoft::Extensions::Caching::Distributed::IDistributedCache ^ cache, System::String ^ sessionKey, TimeSpan idleTimeout, Func<bool> ^ tryEstablishSession, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory, bool isNewSessionKey);
public DistributedSession (Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string sessionKey, TimeSpan idleTimeout, Func<bool> tryEstablishSession, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, bool isNewSessionKey);
new Microsoft.AspNetCore.Session.DistributedSession : Microsoft.Extensions.Caching.Distributed.IDistributedCache * string * TimeSpan * Func<bool> * Microsoft.Extensions.Logging.ILoggerFactory * bool -> Microsoft.AspNetCore.Session.DistributedSession
Public Sub New (cache As IDistributedCache, sessionKey As String, idleTimeout As TimeSpan, tryEstablishSession As Func(Of Boolean), loggerFactory As ILoggerFactory, isNewSessionKey As Boolean)

Parameter

sessionKey
String
idleTimeout
TimeSpan
tryEstablishSession
Func<Boolean>
loggerFactory
ILoggerFactory
isNewSessionKey
Boolean

Berlaku untuk

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

Sumber:
DistributedSession.cs
Sumber:
DistributedSession.cs
Sumber:
DistributedSession.cs

Menginisialisasi instans baru .DistributedSession

public:
 DistributedSession(Microsoft::Extensions::Caching::Distributed::IDistributedCache ^ cache, System::String ^ sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> ^ tryEstablishSession, Microsoft::Extensions::Logging::ILoggerFactory ^ loggerFactory, bool isNewSessionKey);
public DistributedSession (Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> tryEstablishSession, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, bool isNewSessionKey);
new Microsoft.AspNetCore.Session.DistributedSession : Microsoft.Extensions.Caching.Distributed.IDistributedCache * string * TimeSpan * TimeSpan * Func<bool> * Microsoft.Extensions.Logging.ILoggerFactory * bool -> Microsoft.AspNetCore.Session.DistributedSession
Public Sub New (cache As IDistributedCache, sessionKey As String, idleTimeout As TimeSpan, ioTimeout As TimeSpan, tryEstablishSession As Func(Of Boolean), loggerFactory As ILoggerFactory, isNewSessionKey As Boolean)

Parameter

cache
IDistributedCache

yang IDistributedCache digunakan untuk menyimpan data sesi.

sessionKey
String

Kunci unik yang digunakan untuk mencari sesi.

idleTimeout
TimeSpan

Berapa lama sesi dapat tidak aktif (misalnya tidak diakses) sebelum kedaluwarsa.

ioTimeout
TimeSpan

Jumlah waktu maksimum dan CommitAsync(CancellationToken) diperbolehkan memakan waktuLoadAsync(CancellationToken).

tryEstablishSession
Func<Boolean>

Panggilan balik yang dipanggil selama Set(String, Byte[]) untuk memverifikasi bahwa memodifikasi sesi saat ini valid. Jika panggilan balik kembali false, Set(String, Byte[]) melempar InvalidOperationException. SessionMiddleware menyediakan panggilan balik yang kembali false jika sesi tidak dibuat sebelum mengirim respons.

isNewSessionKey
Boolean

true jika membuat sesi baru; false jika melanjutkan sesi.

Berlaku untuk