List of usage examples for org.springframework.data.redis.core BoundHashOperations keys
@Nullable Set<HK> keys();
From source file:net.eggcanfly.spring.shiro.support.RedisSessionDao.java
protected Session deserializeSession(Serializable sessionId) { BoundHashOperations<String, String, Object> hashOperations = redisTemplate .boundHashOps(SESSION_KEY + sessionId); SimpleSession session = new SimpleSession(); try {/* w w w . j a v a 2 s .c o m*/ session.setHost((String) hashOperations.get("host")); session.setId(sessionId); session.setLastAccessTime( hashOperations.get("lastAccessTime") == null ? new Date(System.currentTimeMillis()) : (Date) hashOperations.get("lastAccessTime")); session.setStartTimestamp((Date) hashOperations.get("startTimestamp")); session.setStopTimestamp((Date) hashOperations.get("stopTimestamp")); session.setTimeout((long) hashOperations.get("timeout")); Set<String> hashKeys = hashOperations.keys(); for (Iterator<String> iterator = hashKeys.iterator(); iterator.hasNext();) { String hashKey = iterator.next(); session.setAttribute(hashKey, hashOperations.get(hashKey)); } } catch (Exception e) { logger.error(e.getMessage(), e); } logger.debug("read session " + sessionId + ", session is " + session); return session.isValid() ? session : null; }