public PersonCacheObject GetPerson(string device_id) { PersonCacheObject person = null; if (device_id?.Length > 0 && _cacheDevicePerson.TryGetValue(device_id, out person) && person != null) { return(person); } else if (device_id?.Length > 5 && _cacheDevicePerson.Count == 0) { return(GetPersonFormDb(null, device_id)); } return(null); }
public PersonCacheObject GetPerson(long?phone) { PersonCacheObject person = null; if (phone.HasValue && _cachePhonePerson.TryGetValue(phone.Value, out person) && person != null) { return(person); } else if (phone.HasValue && _cachePhonePerson.Count == 0) { return(_cachePhonePerson[phone.Value] = GetPersonFormDb(phone)); } return(null); }