Class RedisIndexedSessionRepository.RedisSession

java.lang.Object
org.springframework.session.data.redis.RedisIndexedSessionRepository.RedisSession
All Implemented Interfaces:
Session
Enclosing class:
RedisIndexedSessionRepository

public final class RedisIndexedSessionRepository.RedisSession extends Object implements Session
A custom implementation of Session that uses a MapSession as the basis for its mapping. It keeps track of any attributes that have changed. When saveDelta() is invoked all the attributes that have been changed will be persisted.
  • Method Details

    • setLastAccessedTime

      public void setLastAccessedTime(Instant lastAccessedTime)
      Description copied from interface: Session
      Sets the last accessed time.
      Specified by:
      setLastAccessedTime in interface Session
      Parameters:
      lastAccessedTime - the last accessed time
    • isExpired

      public boolean isExpired()
      Description copied from interface: Session
      Returns true if the session is expired.
      Specified by:
      isExpired in interface Session
      Returns:
      true if the session is expired, else false.
    • getCreationTime

      public Instant getCreationTime()
      Description copied from interface: Session
      Gets the time when this session was created.
      Specified by:
      getCreationTime in interface Session
      Returns:
      the time when this session was created.
    • getId

      public String getId()
      Description copied from interface: Session
      Gets a unique string that identifies the Session.
      Specified by:
      getId in interface Session
      Returns:
      a unique string that identifies the Session
    • changeSessionId

      public String changeSessionId()
      Description copied from interface: Session
      Changes the session id. After invoking the Session.getId() will return a new identifier.
      Specified by:
      changeSessionId in interface Session
      Returns:
      the new session id which Session.getId() will now return
    • getLastAccessedTime

      public Instant getLastAccessedTime()
      Description copied from interface: Session
      Gets the last time this Session was accessed.
      Specified by:
      getLastAccessedTime in interface Session
      Returns:
      the last time the client sent a request associated with the session
    • setMaxInactiveInterval

      public void setMaxInactiveInterval(Duration interval)
      Description copied from interface: Session
      Sets the maximum inactive interval between requests before this session will be invalidated. A negative time indicates that the session will never timeout.
      Specified by:
      setMaxInactiveInterval in interface Session
      Parameters:
      interval - the amount of time that the Session should be kept alive between client requests.
    • getMaxInactiveInterval

      public Duration getMaxInactiveInterval()
      Description copied from interface: Session
      Gets the maximum inactive interval between requests before this session will be invalidated. A negative time indicates that the session will never timeout.
      Specified by:
      getMaxInactiveInterval in interface Session
      Returns:
      the maximum inactive interval between requests before this session will be invalidated. A negative time indicates that the session will never timeout.
    • getAttribute

      public <T> T getAttribute(String attributeName)
      Description copied from interface: Session
      Gets the Object associated with the specified name or null if no Object is associated to that name.
      Specified by:
      getAttribute in interface Session
      Type Parameters:
      T - the return type of the attribute
      Parameters:
      attributeName - the name of the attribute to get
      Returns:
      the Object associated with the specified name or null if no Object is associated to that name
    • getAttributeNames

      public Set<String> getAttributeNames()
      Description copied from interface: Session
      Gets the attribute names that have a value associated with it. Each value can be passed into Session.getAttribute(String) to obtain the attribute value.
      Specified by:
      getAttributeNames in interface Session
      Returns:
      the attribute names that have a value associated with it.
      See Also:
    • setAttribute

      public void setAttribute(String attributeName, Object attributeValue)
      Description copied from interface: Session
      Sets the attribute value for the provided attribute name. If the attributeValue is null, it has the same result as removing the attribute with Session.removeAttribute(String) .
      Specified by:
      setAttribute in interface Session
      Parameters:
      attributeName - the attribute name to set
      attributeValue - the value of the attribute to set. If null, the attribute will be removed.
    • removeAttribute

      public void removeAttribute(String attributeName)
      Description copied from interface: Session
      Removes the attribute with the provided attribute name.
      Specified by:
      removeAttribute in interface Session
      Parameters:
      attributeName - the name of the attribute to remove