Example #1
0
  /**
   * Get session instance from redis, the parameter sessionId without the redisSessionPrefix
   *
   * @param sessionId
   * @return
   */
  public Session getSession(Serializable sessionId) {
    log.debug("get session, the sessionId is {}", sessionId);

    return (Session)
        SerializeUtils.deserialize(
            redisTemplate.getValue((redisSessionPrefix + sessionId.toString()).getBytes()));
  }
Example #2
0
 /**
  * store session, the parameter sessionId without the REDIS_SESSION_PREFIX
  *
  * @param sessionId
  * @param session
  */
 public void store(Serializable sessionId, Session session) throws Exception {
   log.debug("store session:{} with sessionId:{}", new Object[] {sessionId, session});
   redisTemplate.setKeyValueExpire(
       sessionId.toString().getBytes(), SerializeUtils.serialize(session), expireTimeInSeconds);
 }