⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usercache.java

📁 反ajax原代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   UserCache.java

package com.laoer.bbscs.sys;

import com.laoer.bbscs.bean.UserInfo;
import com.laoer.bbscs.business.IUserInfoService;
import com.opensymphony.oscache.base.NeedsRefreshException;
import com.opensymphony.oscache.general.GeneralCacheAdministrator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class UserCache
{

    private static final Log logger;
    private static UserCache instance;
    private GeneralCacheAdministrator admin;
    private IUserInfoService userInfoService;
    static Class class$com$laoer$bbscs$sys$UserCache; /* synthetic field */

    public static synchronized UserCache getInstance()
    {
        if(instance == null)
            instance = new UserCache();
        return instance;
    }

    public static synchronized UserCache getInstance(IUserInfoService userInfoService)
    {
        if(instance == null)
            instance = new UserCache(userInfoService);
        return instance;
    }

    public UserCache()
    {
        admin = new GeneralCacheAdministrator();
    }

    public UserCache(IUserInfoService userInfoService)
    {
        admin = new GeneralCacheAdministrator();
        this.userInfoService = userInfoService;
    }

    public void putUserInfoInCache(UserInfo ui)
    {
        logger.debug("Put in UserCache " + ui);
        admin.putInCache(String.valueOf(ui.getId()), ui);
    }

    public UserInfo getUserInfoFromCache(long id)
    {
        return (UserInfo)admin.getFromCache(String.valueOf(id));
        NeedsRefreshException ex;
        ex;
        logger.debug(id + " is not int UserCache,get from DB,put in UserCache.");
        UserInfo ui = getUserInfoService().findUserInfoById(new Long(id));
        if(ui != null)
        {
            admin.putInCache(String.valueOf(id), ui);
            return ui;
        } else
        {
            return null;
        }
    }

    public IUserInfoService getUserInfoService()
    {
        return userInfoService;
    }

    public void setUserInfoService(IUserInfoService userInfoService)
    {
        this.userInfoService = userInfoService;
    }

    static Class class$(String x0)
    {
        return Class.forName(x0);
        ClassNotFoundException x1;
        x1;
        throw new NoClassDefFoundError(x1.getMessage());
    }

    static 
    {
        logger = LogFactory.getLog(class$com$laoer$bbscs$sys$UserCache != null ? class$com$laoer$bbscs$sys$UserCache : (class$com$laoer$bbscs$sys$UserCache = class$("com.laoer.bbscs.sys.UserCache")));
    }
}

⌨️ 快捷键说明

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