/// <summary> /// Instantiates the Dictionary Data Service with the application context /// </summary> /// <param name="applicationContext">The Umbraco Application Context</param> public DictionaryDataService(ApplicationContext applicationContext) { this.appContext = applicationContext ?? throw new ArgumentNullException(nameof(applicationContext)); this.localisationService = applicationContext.Services.LocalizationService; this.db = applicationContext.DatabaseContext.Database; this.isolatedRuntimeCache = applicationContext.ApplicationCache.IsolatedRuntimeCache; }
/// <summary> /// Initializes a new instance based on the provided providers /// </summary> /// <param name="httpCacheProvider"></param> /// <param name="staticCacheProvider"></param> /// <param name="requestCacheProvider"></param> /// <param name="isolatedCacheManager"></param> public CacheHelper( IRuntimeCacheProvider httpCacheProvider, ICacheProvider staticCacheProvider, ICacheProvider requestCacheProvider, IsolatedRuntimeCache isolatedCacheManager) { if (httpCacheProvider == null) { throw new ArgumentNullException("httpCacheProvider"); } if (staticCacheProvider == null) { throw new ArgumentNullException("staticCacheProvider"); } if (requestCacheProvider == null) { throw new ArgumentNullException("requestCacheProvider"); } if (isolatedCacheManager == null) { throw new ArgumentNullException("isolatedCacheManager"); } RuntimeCache = httpCacheProvider; StaticCache = staticCacheProvider; RequestCache = requestCacheProvider; IsolatedRuntimeCache = isolatedCacheManager; }
public static CacheHelper GetCacheHelper(IRuntimeCacheProvider httpCache = null, ICacheProvider staticCache = null, ICacheProvider requestCache = null, IsolatedRuntimeCache isolastedRuntime = null) { return(new CacheHelper(httpCache ?? Mock.Of <IRuntimeCacheProvider>(), staticCache ?? Mock.Of <ICacheProvider>(), requestCache ?? Mock.Of <ICacheProvider>(), isolastedRuntime ?? GetIsolatedRuntimeCache())); }
protected override IRuntimeCacheProvider GetIsolatedCache(IsolatedRuntimeCache provider) { return(NullCache); }