public IPRestrictionsService( IPRestrictionsRepository iPRestrictionsRepository, IPRestrictionsServiceCache iPRestrictionsServiceCache) { IPRestrictionsRepository = iPRestrictionsRepository; cache = iPRestrictionsServiceCache.Cache; notify = iPRestrictionsServiceCache.Notify; }
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); }