Skip to content

Instantly share code, notes, and snippets.

@trnktms
Created October 31, 2019 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/4c213e0d4237d801035bb1c396dfaec8 to your computer and use it in GitHub Desktop.
Save trnktms/4c213e0d4237d801035bb1c396dfaec8 to your computer and use it in GitHub Desktop.
public class DistributedSessionStoreWithStart : DistributedSessionStore, ISessionStore
{
readonly IStartSession _startSession;
public DistributedSessionStoreWithStart(
IDistributedCache cache,
ILoggerFactory loggerFactory,
IStartSession startSession)
: base(cache, loggerFactory)
{
_startSession = startSession;
}
public new ISession Create(
string sessionKey,
TimeSpan idleTimeout,
TimeSpan ioTimeout,
Func<bool> tryEstablishSession,
bool isNewSessionKey)
{
var session = base.Create(sessionKey, idleTimeout, ioTimeout, tryEstablishSession, isNewSessionKey);
if (isNewSessionKey)
{
_startSession.InvokeStartSesssionActions(session);
}
return session;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment