Partager via


DistributedSession Constructeurs

Définition

Surcharges

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

Initialise une nouvelle instance de 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)

Paramètres

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

S’applique à

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

Source:
DistributedSession.cs
Source:
DistributedSession.cs
Source:
DistributedSession.cs

Initialise une nouvelle instance de 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)

Paramètres

cache
IDistributedCache

IDistributedCache utilisé pour stocker les données de session.

sessionKey
String

Clé unique utilisée pour rechercher la session.

idleTimeout
TimeSpan

Durée pendant laquelle la session peut être inactive (par exemple, inaccessible) avant son expiration.

ioTimeout
TimeSpan

Durée maximale et LoadAsync(CancellationToken)CommitAsync(CancellationToken) sont autorisés à prendre.

tryEstablishSession
Func<Boolean>

Rappel appelé pendant Set(String, Byte[]) pour vérifier que la modification de la session est actuellement valide. Si le rappel retourne false, Set(String, Byte[]) lève un InvalidOperationException. SessionMiddleware fournit un rappel qui retourne false si la session n’a pas été établie avant l’envoi de la réponse.

loggerFactory
ILoggerFactory

L’ILoggerFactoryopérateur

isNewSessionKey
Boolean

true si vous établissez une nouvelle session ; false si vous reprenez une session.

S’applique à