62,046
社区成员
发帖
与我相关
我的任务
分享
//我在BLL层设
public DataSet GetDataSet(string where)
{
if(GetCache("cache1")!=null)
{
return GetCache("cache1");
}
DataSet ds=dal.GetDS(where);
SetCache("check1",ds);
return ds;
}
//ul 调用
bll.GetDataSet("id>100");//使用了cache1的key取出了id>100的数据
bll.GetDataSet("id<100");//同样也使用cache1的key取出id>100的数据
//问。怎样才能动态,缓存。难道要在这里加个参数key?
public DataSet GetDataSet(string where,string key)
{
if(GetCache(key)!=null)
{
return GetCache(key);
}
DataSet ds=dal.GetDS(where);
SetCache(key,ds);
return ds;
}
//再问,我想把缓存放在一个Cachelibrary 类库里,使用BLL去调它的缓存数据,不知怎样设计