コード例 #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);
        }