java.lang.Object
io.jooby.redis.RedisSessionStore
- All Implemented Interfaces:
SessionStore
Redis session store.
- Since:
- 2.8.5
- Author:
- edgar
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jooby.SessionStore
SessionStore.InMemory -
Field Summary
Fields inherited from interface io.jooby.SessionStore
DEFAULT_TIMEOUT, UNSUPPORTED -
Constructor Summary
ConstructorsConstructorDescriptionRedisSessionStore(SessionToken token, io.lettuce.core.RedisClient redis) Creates a new session store.RedisSessionStore(SessionToken token, org.apache.commons.pool2.impl.GenericObjectPool<io.lettuce.core.api.StatefulRedisConnection<String, String>> pool) Creates a new session store. -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteSession(Context ctx, Session session) findSession(Context ctx) Redis namespace (key prefix).Session timeout.getToken()Session token.newSession(Context ctx) Remove session timeout.voidrenewSessionId(Context ctx, Session session) voidsaveSession(Context ctx, Session session) setNamespace(String namespace) Set redis namespace or key prefix.setTimeout(Duration timeout) Set/change session timeout.voidtouchSession(Context ctx, Session session)
-
Constructor Details
-
RedisSessionStore
public RedisSessionStore(@NonNull SessionToken token, @NonNull org.apache.commons.pool2.impl.GenericObjectPool<io.lettuce.core.api.StatefulRedisConnection<String, String>> pool) Creates a new session store.- Parameters:
token- Session token.pool- Redis connection pool.
-
RedisSessionStore
Creates a new session store.- Parameters:
token- Session token.redis- Redis connection.
-
-
Method Details
-
getNamespace
Redis namespace (key prefix).- Returns:
- Redis namespace (key prefix). Default is:
sessions.
-
setNamespace
Set redis namespace or key prefix.- Parameters:
namespace- Redis namespace or key prefix.- Returns:
- This store.
-
getTimeout
Session timeout.- Returns:
- Session timeout. Default is:
30 minutes.
-
setTimeout
Set/change session timeout.- Parameters:
timeout- Timeout must be positive value. Otherwise, timeout is disabled.- Returns:
- This store.
-
noTimeout
Remove session timeout.- Returns:
- This store.
-
getToken
Session token.- Returns:
- Session token.
-
newSession
- Specified by:
newSessionin interfaceSessionStore
-
findSession
- Specified by:
findSessionin interfaceSessionStore
-
deleteSession
- Specified by:
deleteSessionin interfaceSessionStore
-
touchSession
- Specified by:
touchSessionin interfaceSessionStore
-
saveSession
- Specified by:
saveSessionin interfaceSessionStore
-
renewSessionId
- Specified by:
renewSessionIdin interfaceSessionStore
-