In AppHost.cs
container.Register<IRedisClientsManager>(
c => new PooledRedisClientManager(redisConnectionString));
I'm not seeing these sessions getting cleaned up in 30sec.
public class MyUserSession: AuthUserSession {
public override void OnAuthenticated(IServiceBase authService,
IAuthSession session, IAuthTokens tokens,
Dictionary <string, string > authInfo) {
...do stuff here
authService.SaveSession(session, TimeSpan.FromSeconds(30));
}
}
Am I missing something in the redis config or possibly setting this wrong? Also, if i log in a second time, they start to accumulate for the identical user. Are we supposed to cleanup in this method if there's an existing session for the current user?
That would only save the session for that time, it would get overwritten if with the default expiry if the Session was saved again.
You can control each time the Session is saved by overriding AppHostBase.OnSaveSession()
, e.g:
public override void OnSaveSession(
IRequest httpReq, IAuthSession session, TimeSpan? expiresIn = null)
{
base.OnSaveSession(session, TimeSpan.FromSeconds(30));
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments