using System; using System.Collections.Generic; using Library; using System.Linq; using MySystem.MainModels; namespace MySystem { public class UserForMobileDbconn { public readonly static UserForMobileDbconn Instance = new UserForMobileDbconn(); #region 获取单个字段 public UserForMobile Get(string Mobile) { // string key = "UserForMobile:" + Mobile; // if (RedisDbconn.Instance.Exists(key)) // { // UserForMobile obj = RedisDbconn.Instance.Get(key); // if (obj != null) // { // return obj; // } // } WebCMSEntities db = new WebCMSEntities(); UserForMobile userFor = db.UserForMobile.FirstOrDefault(m => m.Mobile == Mobile); if (userFor != null) { // RedisDbconn.Instance.Set(key, userFor); // RedisDbconn.Instance.SetExpire(key, Library.function.get_Random(1800, 5400)); } db.Dispose(); return userFor; } #endregion } }