dirchildrencache.java

来自「cwbbs 云网论坛源码」· Java 代码 · 共 74 行

JAVA
74
字号
package com.redmoon.blog.photo;import java.util.*;import cn.js.fan.cache.jcs.*;import org.apache.log4j.*;import com.cloudwebsoft.framework.util.LogUtil;public class DirChildrenCache {    String parentCode;    RMCache rmCache = RMCache.getInstance();    static String cachePrix = "blog_photo_dir_list_";    Vector list = null;    static String group = "Blog_Photo_Leaf_Children";    public DirChildrenCache(String parentCode) {        this.parentCode = parentCode;        list = getDirList();    }    public Vector getList() {        return list;    }    public Vector getDirList() {        Vector v = null;        try {            v = (Vector) rmCache.getFromGroup(cachePrix + parentCode, group);        }        catch (Exception e) {            LogUtil.getLog(getClass()).error("getDirList:" + e.getMessage());        }        if (v == null) {            try {                v = load();                rmCache.putInGroup(cachePrix + parentCode, group, v);            } catch (Exception e) {                LogUtil.getLog(getClass()).error("getDirList:" + e.getMessage());            }        }        else {            Iterator ir = v.iterator();            while (ir.hasNext()) {                DirDb lf = (DirDb) ir.next();                lf.renew();            }        }        return v;    }    public Vector load() {        DirDb dd = new DirDb();        dd = dd.getDirDb(parentCode);        return dd.getChildren();    }    public static void remove(String parentCode) {        try {            RMCache rmCache = RMCache.getInstance();            rmCache.remove(cachePrix + parentCode, group);        } catch (Exception e) {            LogUtil.getLog("com.redmoon.blog.photo.DirChildrenCache").error(e.getMessage());        }    }    public static void removeAll() {        try {            RMCache rmCache = RMCache.getInstance();            rmCache.invalidateGroup(group);        } catch (Exception e) {            LogUtil.getLog("com.redmoon.blog.photo.DirChildrenCache").error(e.getMessage());        }    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?