1、xml配置
2、Java调用
java调用//service层查询时代码@Autowiredprivate JedisClient jedisClient; @Overridepublic Listlist() { // TODO Auto-generated method stub try { String json = jedisClient.hget("user", "list"); if (StringUtils.isNotBlank(json)) { List users = JsonUtils.jsonToList(json, User.class); return users; } } catch (Exception e) { e.printStackTrace(); } //使用持久层查询数据库 List list = userMapper.list(); try { jedisClient.hset("user", "list", JsonUtils.objectToJson(list)); } catch (Exception e) { e.printStackTrace(); } return list;}