Class 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
    • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getActiveSessionsKey()  
      java.nio.charset.Charset getCharset()  
      java.time.Duration getExpiredSessionCheck()  
      java.lang.String getNamespace()  
      java.util.Optional<java.lang.String> getServerName()  
      java.lang.String getSessionCreatedTopic()  
      java.util.Optional<java.lang.Class<io.micronaut.core.serialize.ObjectSerializer>> getValueSerializer()  
      io.micronaut.configuration.lettuce.session.RedisHttpSessionConfiguration.WriteMode getWriteMode()  
      boolean isEnableKeyspaceEvents()  
      void setActiveSessionsKey​(java.lang.String activeSessionsKey)
      Sets the key to store active sessions in.
      void setCharset​(java.nio.charset.Charset charset)
      Sets the charset to use to serialize values.
      void setEnableKeyspaceEvents​(boolean enableKeyspaceEvents)
      Sets whether keyspace events should be enabled at startup.
      void setExpiredSessionCheck​(java.time.Duration expiredSessionCheck)
      Sets the duration to check for expired sessions.
      void setNamespace​(java.lang.String namespace)
      Sets the namespace to use.
      void setServerName​(java.lang.String serverName)
      Sets the server name.
      void setSessionCreatedTopic​(java.lang.String sessionCreatedTopic)
      Sets the topic to publish session created events to.
      void setValueSerializer​(java.lang.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 Detail

      • RedisHttpSessionConfiguration

        public RedisHttpSessionConfiguration()
    • Method Detail

      • getNamespace

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

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

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

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

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

        public java.nio.charset.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 java.time.Duration getExpiredSessionCheck()
        Returns:
        The duration with which to check for expired sessions
      • setNamespace

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

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

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

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

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

        public void setCharset​(java.nio.charset.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​(java.time.Duration expiredSessionCheck)
        Sets the duration to check for expired sessions.
        Parameters:
        expiredSessionCheck - The expired session check