package com.data.cache;

import com.data.bean.BaseBean;
import com.data.bean.GameBean;

/**
 * game cache class.
 */
public class GameCache extends BaseCache{

	protected GameCache() {
		super("game:","group1_db1");
	}

	static GameCache inst;
	
	public static GameBean getGame(int id) {
		if(inst==null) {
			inst = new GameCache();
		}
		return inst.getBean(id);
	}
	
	public static GameBean getGame(String key) {
		if(inst==null) {
			inst = new GameCache();
		}
		return inst.getBean(key);
	}

	@Override
	protected BaseBean newBean() {
		return new GameBean();
	}
	
	public static void clearData() {
		if(inst==null)inst = new GameCache();
		inst.clearExpireData();
	}
	
	public static String genKey(int gid) {
		return "game_" + gid;
	}
}
