ServiceStack - Redis Sessions Accumulating

Chuck D

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));
  }
}

enter image description here

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?

mythz

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

ServiceStack sharing sessions between processes

From Dev

loopback redis based sessions

From Dev

ServiceStack Redis Messaging - IMessage?

From Dev

Alternative to servicestack.redis

From Dev

Using ServiceStack Redis with Twemproxy

From Dev

ServiceStack Redis Serialization Error

From Dev

Alternative to servicestack.redis

From Dev

ServiceStack.Redis SearchKeys

From Dev

MongoDB vs Redis for user sessions?

From Dev

Removing sessions from Redis (Django)

From Dev

Sidekiq Forbidden error with Redis sessions

From Dev

ServiceStack Redis - caching expensive queries

From Dev

How to change Laravel 5 sessions to redis

From Dev

Get list of existing sessions on connect-redis

From Dev

Django sessions stop working after Redis implementation

From Dev

Alternative for storing information between sessions similar to redis

From Dev

How to unserialize PHP sessions from Redis?

From Dev

ServiceStack Redis, how to return Lua table as List

From Dev

Using complex types in RedisTypedClient (ServiceStack Redis)

From Dev

Redis client for C# (serviceStack) - where is the documentation?

From Dev

Redis Pub/Sub ServiceStack, cancelling the thread

From Dev

Mutex violations using ServiceStack Redis for distributed locking

From Dev

Keep copy of original request in Servicestack Redis outq

From Dev

Is it possible to add custom headers to a ServiceStack Redis message?

From Dev

ServiceStack.Redis: Unable to Connect: sPort:

From Dev

MVC4 and ServiceStack session in Redis

From Dev

ServiceStack.Redis Unable to read transport - BasicRedisClientManager

From Dev

ASP.NET vnext and ServiceStack.redis

From Dev

ServiceStack Redis client : remove all objects

Related Related

HotTag

Archive