Пример #1
0
  @SuppressWarnings("rawtypes")
  public List<Code> GetCodeCache() {
    List<Code> list = new ArrayList<Code>();

    if (MemCached.used()) {
      Object obj = MemCached.getInstance().get("Code");
      if (obj != null && !obj.equals("")) {
        String json = MemCached.getInstance().get("Code").toString();

        JSONArray array = JSONArray.fromObject(json);
        for (Iterator iter = array.iterator(); iter.hasNext(); ) {
          JSONObject jsonObject = (JSONObject) iter.next();
          list.add((Code) JSONObject.toBean(jsonObject, Code.class));
        }
      } else {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("status", "Y");
        list = this.findForUnPage(params);

        JSONArray jsonObject = JSONArray.fromObject(list);

        MemCached.getInstance().set("Code", jsonObject);
      }
    }

    return list;
  }
Пример #2
0
 public void clearCodeCache() {
   if (MemCached.used()) {
     Object obj = MemCached.getInstance().get("Code");
     if (obj != null && !obj.equals("")) {
       MemCached.getInstance().set("Code", "");
     }
   }
 }
 public void ClearMenuConfigCache() {
   if (MemCached.used()) {
     Object obj = MemCached.getInstance().get("MenuConfig");
     if (obj != null && !obj.equals("")) {
       MemCached.getInstance().set("MenuConfig", "");
     }
   }
 }