public bool AddList <T>(IEnumerable <T> data) { if (data == null || data.Count() < 1 || !IsCachingServer) { return(false); } try { List <Tuple <string, T> > objList = new List <Tuple <string, T> >(); PropertyInfo[] properties = typeof(T).GetProperties(); string pattern = Helper.GetClassName <T>() + ":"; foreach (var obj in data) { var key = pattern + properties[0].GetValue(obj).ToString(); objList.Add(Tuple.Create(key, obj)); } //Keys var keys = Sut.SearchKeys(pattern); if (keys.Count() > 0) { Sut.RemoveAll(keys); } //Add if (TimeExpried > 0) { return(Sut.AddAll(objList, TimeSpan.FromMinutes(TimeExpried))); } else { return(Sut.AddAll(objList)); } } catch (Exception ex) { LogManager.Logger.LogError(ex); return(false); } }
public bool AddAll <T>(IList <Tuple <string, T> > items) { return(_clientExt.AddAll(items)); }