Class SplitSession
Implementation of ISession that stores large session attributes as separate cache entries.
Implements
Inherited Members
Namespace: Tangosol.Web.Model
Assembly: Coherence.SessionStore.dll
Syntax
public class SplitSession : AbstractSession, ISession
Constructors
SplitSession(INamedCache, INamedCache, string, string, TimeSpan, TimeSpan, Func<bool>, bool, int)
Construct a new instance of SplitSession.
Declaration
public SplitSession(INamedCache sessionCache, INamedCache overflowCache, string applicationId, string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey, int minOverflowAttrSize)
Parameters
Type | Name | Description |
---|---|---|
INamedCache | sessionCache | The session cache |
INamedCache | overflowCache | The overflow attributes cache |
string | applicationId | The application identity |
string | sessionKey | A unique key used to lookup the session. |
TimeSpan | idleTimeout | How long the session can be inactive (e.g. not accessed) before it will expire. |
TimeSpan | ioTimeout | The maximum amount of time LoadAsync(CancellationToken) and CommitAsync(CancellationToken) are allowed take. |
Func<bool> | tryEstablishSession | A callback invoked during Set(string, byte[]) to verify that modifying the session is currently valid. If the callback returns false, Set(string, byte[]) should throw an InvalidOperationException. SessionMiddleware provides a callback that returns false if the session was not established prior to sending the response. |
bool | isNewSessionKey | true if establishing a new session; false if resuming a session. |
int | minOverflowAttrSize | Minimum overflow attribute size. |
Properties
IsAvailable
Indicates whether the current session loaded successfully. Accessing this property before the session is loaded will cause it to be loaded inline.
Declaration
public override bool IsAvailable { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Keys
Enumerates all the keys, if any.
Declaration
public override IEnumerable<string> Keys { get; }
Property Value
Type | Description |
---|---|
IEnumerable<string> |
Overrides
Methods
Clear()
Remove all entries from the current session, if any. The session cookie is not removed.
Declaration
public override void Clear()
Overrides
CommitAsync(CancellationToken)
Store the session in the data store. This may throw if the data store is unavailable.
Declaration
public override Task CommitAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Overrides
LoadAsync(CancellationToken)
Load the session from the data store. This may throw if the data store is unavailable.
Declaration
public override Task LoadAsync(CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken |
Returns
Type | Description |
---|---|
Task |
Overrides
Remove(string)
Remove the given key from the session if present.
Declaration
public override void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key |
Overrides
Set(string, byte[])
Set the given key and value in the current session. This will throw if the session was not established prior to sending the response.
Declaration
public override void Set(string key, byte[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | |
byte[] | value |
Overrides
TryGetValue(string, out byte[])
Retrieve the value of the given key, if present.
Declaration
public override bool TryGetValue(string key, out byte[] value)
Parameters
Type | Name | Description |
---|---|---|
string | key | |
byte[] | value |
Returns
Type | Description |
---|---|
bool | The retrieved value. |