private List <Host> GetHostsFromCache()
        {
            List <Host> hosts;

            try
            {
                byte[] fromRedisCache = _distributedCache.Get("AllSummaryHost");
                if (fromRedisCache != null)
                {
                    hosts = (List <Host>)ByteArrayToObject(fromRedisCache);
                }
                else
                {
                    hosts = HostRepository.GetAll();
                    byte[] toRedisCache = ObjectToByteArray(hosts);
                    _distributedCache.Set("AllSummaryHost", toRedisCache);
                }
            }
            catch
            {
                hosts = HostRepository.GetAll();
            }
            return(hosts);
        }
Esempio n. 2
0
 public IEnumerable <Host> GetAll()
 {
     return(_hostrepository.GetAll());
 }
Esempio n. 3
0
 public IList <Host> GetAll()
 {
     return(_hostRepository.GetAll("HostName", "Asc"));
 }