从redis中取出数据并转成java对象

时间:2020-09-03 19:17:11   收藏:0   阅读:881

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);

原文:https://www.cnblogs.com/yebuzhiqiu/p/13608965.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!