1、//數據存入redis中
redisTemplate.opsForValue().set(loginame, JSON.toJSONString(users),1000,TimeUnit.SECONDS);
2、//獲取數據並轉成用戶實體
String userJson = (String) redisTemplate.opsForValue().get("loginame");
UserEntity user = (UserEntity) JSONArray.parseArray(userJson, UserEntity.class);