protected MemberInfo GetCacheMemberInfo(string userName)
{
MemberInfo minfo = new MemberInfo();//实体
minfo = System.Web.HttpRuntime.Cache.Get("HotPP_" + userName) as MemberInfo;//读缓存
if (minfo == null)
{
MemberInfo[] minfos = SASAPIHelper.GetMembers(1);
List<MemberInfo> mlist = new List<MemberInfo>();
mlist.AddRange(minfos);
//委托
Predicate<MemberInfo> mpush = new Predicate<MemberInfo>(delegate(MemberInfo info) { return info.Name == userName; });
minfo = mlist.Find(mpush);
//加缓存
System.Web.HttpRuntime.Cache.Insert("HotPP_" + userName, minfo, null, DateTime.Now.AddMinutes(30), System.Web.Caching.Cache.NoSlidingExpiration);
}
return minfo;//返回实体
}