예제 #1
0
 public IPRestrictionsService(
     IPRestrictionsRepository iPRestrictionsRepository,
     IPRestrictionsServiceCache iPRestrictionsServiceCache)
 {
     IPRestrictionsRepository = iPRestrictionsRepository;
     cache  = iPRestrictionsServiceCache.Cache;
     notify = iPRestrictionsServiceCache.Notify;
 }
예제 #2
0
        public IEnumerable <IPRestriction> Get(int tenant)
        {
            var key          = IPRestrictionsServiceCache.GetCacheKey(tenant);
            var restrictions = cache.Get <List <IPRestriction> >(key);

            if (restrictions == null)
            {
                cache.Insert(key, restrictions = IPRestrictionsRepository.Get(tenant), timeout);
            }
            return(restrictions);
        }