44 lines
782 B
Java
44 lines
782 B
Java
|
|
package com.data.cache;
|
||
|
|
|
||
|
|
import com.data.bean.AccountBean;
|
||
|
|
import com.data.bean.BaseBean;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* account cache class.
|
||
|
|
*/
|
||
|
|
public class AccountCache extends BaseCache{
|
||
|
|
|
||
|
|
protected AccountCache() {
|
||
|
|
super("{user}:","group1_db0");
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
static AccountCache inst;
|
||
|
|
|
||
|
|
|
||
|
|
public static AccountBean getAccount(int id) {
|
||
|
|
if(inst==null)inst = new AccountCache();
|
||
|
|
return inst.getBean(id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public static AccountBean getAccount(String session) {
|
||
|
|
if(inst==null)inst = new AccountCache();
|
||
|
|
return inst.getBean(session);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
@Override
|
||
|
|
protected BaseBean newBean() {
|
||
|
|
return new AccountBean();
|
||
|
|
}
|
||
|
|
|
||
|
|
public static void clearData() {
|
||
|
|
if(inst==null)inst = new AccountCache();
|
||
|
|
inst.clearExpireData();
|
||
|
|
}
|
||
|
|
|
||
|
|
public static String genKey(int gid) {
|
||
|
|
return "{user}:" + gid;
|
||
|
|
}
|
||
|
|
}
|