DistributedSession Konstruktor
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Overload
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
- cache
- IDistributedCache
- sessionKey
- String
- idleTimeout
- TimeSpan
- 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).
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.
- loggerFactory
- ILoggerFactory
- isNewSessionKey
- Boolean
true
jika membuat sesi baru; false
jika melanjutkan sesi.