Show / Hide Table of Contents

Class AbstractSession

Abstract base implementation of ISession

Inheritance
object
AbstractSession
MonolithicSession
SplitSession
Implements
ISession
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Tangosol.Web.Model
Assembly: Coherence.SessionStore.dll
Syntax
public abstract class AbstractSession : ISession

Constructors

AbstractSession(INamedCache, string, string, TimeSpan, TimeSpan, Func<bool>, bool)

Construct SplitSession

Declaration
protected AbstractSession(INamedCache sessionCache, string applicationId, string sessionKey, TimeSpan idleTimeout, TimeSpan ioTimeout, Func<bool> tryEstablishSession, bool isNewSessionKey)
Parameters
Type Name Description
INamedCache sessionCache

The session 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.

Properties

ApplicationId

The application identity

Declaration
protected string ApplicationId { get; }
Property Value
Type Description
string

Id

A unique identifier for the current session. This is not the same as the session cookie since the cookie lifetime may not be the same as the session entry lifetime in the data store.

Declaration
public string Id { get; }
Property Value
Type Description
string

IdleTimeout

How long the session can be inactive (e.g. not accessed) before it will expire.

Declaration
protected TimeSpan IdleTimeout { get; }
Property Value
Type Description
TimeSpan

IoTimeout

The maximum amount of time LoadAsync(CancellationToken) and CommitAsync(CancellationToken) are allowed take.

Declaration
protected TimeSpan IoTimeout { get; }
Property Value
Type Description
TimeSpan

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 abstract bool IsAvailable { get; }
Property Value
Type Description
bool

IsNewSessionKey

true if establishing a new session; false if resuming a session.

Declaration
protected bool IsNewSessionKey { get; }
Property Value
Type Description
bool

Keys

Enumerates all the keys, if any.

Declaration
public abstract IEnumerable<string> Keys { get; }
Property Value
Type Description
IEnumerable<string>

SessionCache

Session cache.

Declaration
protected INamedCache SessionCache { get; }
Property Value
Type Description
INamedCache

SessionKey

a unique key used to look up the session.

Declaration
protected SessionKey SessionKey { get; }
Property Value
Type Description
SessionKey

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[]) throws an InvalidOperationException. SessionMiddleware provides a callback that returns false if the session was not established prior to sending the response.

Declaration
protected Func<bool> TryEstablishSession { get; }
Property Value
Type Description
Func<bool>

Methods

Clear()

Remove all entries from the current session, if any. The session cookie is not removed.

Declaration
public abstract void Clear()

CommitAsync(CancellationToken)

Store the session in the data store. This may throw if the data store is unavailable.

Declaration
public abstract Task CommitAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task

LoadAsync(CancellationToken)

Load the session from the data store. This may throw if the data store is unavailable.

Declaration
public abstract Task LoadAsync(CancellationToken cancellationToken = default)
Parameters
Type Name Description
CancellationToken cancellationToken
Returns
Type Description
Task

Remove(string)

Remove the given key from the session if present.

Declaration
public abstract void Remove(string key)
Parameters
Type Name Description
string key

ResetSessionTimeout()

Reset session timeout.

Declaration
protected virtual void ResetSessionTimeout()

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 abstract void Set(string key, byte[] value)
Parameters
Type Name Description
string key
byte[] value

TryGetValue(string, out byte[])

Retrieve the value of the given key, if present.

Declaration
public abstract bool TryGetValue(string key, out byte[] value)
Parameters
Type Name Description
string key
byte[] value
Returns
Type Description
bool

The retrieved value.

Implements

ISession
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.