Class RedisHttpSessionConfiguration

java.lang.Object
io.micronaut.session.SessionConfiguration
io.micronaut.session.http.HttpSessionConfiguration
io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration
All Implemented Interfaces:
io.micronaut.core.util.Toggleable, io.micronaut.http.cookie.CookieConfiguration

@ConfigurationProperties("redis") public class RedisHttpSessionConfiguration extends io.micronaut.session.http.HttpSessionConfiguration implements io.micronaut.core.util.Toggleable
Configuration properties for Redis session.
Since:
1.0
Author:
Graeme Rocher
  • Field Summary

    Fields inherited from class io.micronaut.session.http.HttpSessionConfiguration

    DEFAULT_BASE64ENCODE, DEFAULT_COOKIENAME, DEFAULT_COOKIEPATH, DEFAULT_REMEMBERME

    Fields inherited from class io.micronaut.session.SessionConfiguration

    DEFAULT_MAXINACTIVEINTERVAL_MINUTES
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
     
     
     
     
     
    Optional<Class<io.micronaut.core.serialize.ObjectSerializer>>
     
    io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration.WriteMode
     
    boolean
     
    void
    setActiveSessionsKey(String activeSessionsKey)
    Sets the key to store active sessions in.
    void
    Sets the charset to use to serialize values.
    void
    setEnableKeyspaceEvents(boolean enableKeyspaceEvents)
    Sets whether keyspace events should be enabled at startup.
    void
    setExpiredSessionCheck(Duration expiredSessionCheck)
    Sets the duration to check for expired sessions.
    void
    setNamespace(String namespace)
    Sets the namespace to use.
    void
    setServerName(String serverName)
    Sets the server name.
    void
    setSessionCreatedTopic(String sessionCreatedTopic)
    Sets the topic to publish session created events to.
    void
    setValueSerializer(Class<io.micronaut.core.serialize.ObjectSerializer> valueSerializer)
    Sets the default value serializer to use.
    void
    setWriteMode(io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration.WriteMode writeMode)
    Sets the write mode to use.

    Methods inherited from class io.micronaut.session.http.HttpSessionConfiguration

    getCookieDomain, getCookieMaxAge, getCookieName, getCookiePath, getCookieSameSite, getDomainName, getHeaderNames, getPrefix, isBase64Encode, isCookieHttpOnly, isCookieSecure, isRememberMe, setBase64Encode, setCookieDomain, setCookieMaxAge, setCookieName, setCookiePath, setCookieSameSite, setCookieSecure, setDomainName, setHeaderNames, setPrefix, setRememberMe

    Methods inherited from class io.micronaut.session.SessionConfiguration

    getExecutorService, getMaxActiveSessions, getMaxInactiveInterval, isPromptExpiration, setExecutorService, setMaxActiveSessions, setMaxInactiveInterval, setPromptExpiration

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.util.Toggleable

    isEnabled
  • Constructor Details

    • RedisHttpSessionConfiguration

      public RedisHttpSessionConfiguration()
  • Method Details

    • getNamespace

      public String getNamespace()
      Returns:
      The key prefix to use for reading and writing sessions
    • getServerName

      public Optional<String> getServerName()
      Returns:
      The name of the a configured Redis server to use.
    • getSessionCreatedTopic

      public String getSessionCreatedTopic()
      Returns:
      The topic to use to publish the creation of new sessions.
    • getActiveSessionsKey

      public String getActiveSessionsKey()
      Returns:
      The key of the sorted set used to maintain a set of active sessions.
    • getValueSerializer

      public Optional<Class<io.micronaut.core.serialize.ObjectSerializer>> getValueSerializer()
      Returns:
      The ObjectSerializer type to use for serializing values. Defaults to JdkSerializer
    • getCharset

      public Charset getCharset()
      Returns:
      The charset to use when encoding sessions
    • isEnableKeyspaceEvents

      public boolean isEnableKeyspaceEvents()
      Returns:
      Whether keyspace events should be enabled programmatically
    • getWriteMode

      public io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration.WriteMode getWriteMode()
      Returns:
      The RedisHttpSessionConfiguration.WriteMode to use. Defaults to RedisHttpSessionConfiguration.WriteMode.BATCH
    • getExpiredSessionCheck

      public Duration getExpiredSessionCheck()
      Returns:
      The duration with which to check for expired sessions
    • setNamespace

      public void setNamespace(String namespace)
      Sets the namespace to use.
      Parameters:
      namespace - The namespace
    • setServerName

      public void setServerName(String serverName)
      Sets the server name.
      Parameters:
      serverName - The server name
    • setSessionCreatedTopic

      public void setSessionCreatedTopic(String sessionCreatedTopic)
      Sets the topic to publish session created events to.
      Parameters:
      sessionCreatedTopic - The session created topic
    • setActiveSessionsKey

      public void setActiveSessionsKey(String activeSessionsKey)
      Sets the key to store active sessions in.
      Parameters:
      activeSessionsKey - The active session key
    • setValueSerializer

      public void setValueSerializer(Class<io.micronaut.core.serialize.ObjectSerializer> valueSerializer)
      Sets the default value serializer to use.
      Parameters:
      valueSerializer - The value serializer
    • setCharset

      public void setCharset(Charset charset)
      Sets the charset to use to serialize values.
      Parameters:
      charset - The default charset
    • setEnableKeyspaceEvents

      public void setEnableKeyspaceEvents(boolean enableKeyspaceEvents)
      Sets whether keyspace events should be enabled at startup.
      Parameters:
      enableKeyspaceEvents - True if keyspace event should be enabled
    • setWriteMode

      public void setWriteMode(io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration.WriteMode writeMode)
      Sets the write mode to use.
      Parameters:
      writeMode - The write mode
    • setExpiredSessionCheck

      public void setExpiredSessionCheck(Duration expiredSessionCheck)
      Sets the duration to check for expired sessions.
      Parameters:
      expiredSessionCheck - The expired session check