伪代码如下:
public void save(){ Map<String,Object> map = new HashMap<String,Object>(); map.put("bList",bList); map.put("sList",sList); map.put("tList",tList); map.put("aList",aList); map.put("gList",gList); map.put("updateTime",datetime); String str = JSONObject.toJSONString(map); this.cacheService.set(RedisKey.STop_LIST_ + String.valueOf(updateTime),str); } public Map<String,Object> get(){ Map<String,Object>(); if (this.cacheService.exists(RedisKey.STop_LIST_ + dateStr)) { String jsonStr = this.cacheService.get(RedisKey.STop_LIST_ + dateWdjStr); Map<String,Object> result = (Map<String,Object>) JSON.parse(jsonStr); List<ViewVo> bList = JSONObject.parseArray(result.get("bList").toString(),ViewVo.class); List<ViewVo> sList = JSONObject.parseArray(result.get("sList").toString(),ViewVo.class); List<ViewVo> tList = JSONObject.parseArray(result.get("tList").toString(),ViewVo.class); List<ViewVo> aList = JSONObject.parseArray(result.get("aList").toString(),ViewVo.class); List<ViewVo> gList = JSONObject.parseArray(result.get("gList").toString(),ViewVo.class); Timestamp updateTime = JSONObject.parSEObject(result.get("updateTime").toString(),Timestamp.class); map.put("bList",bList); map.put("sList",sList); map.put("tList",tList); map.put("aList",aList); map.put("gList",gList); map.put("updateTime",updateTime); return map; } }原文链接:/json/288832.html