Example #1
0
 public static IConfigurationSourceConfigurator WithDefaultMemoryCache(this IConfigurationSourceConfigurator configurationSourceConfigurator, TimeSpan expiresAfter)
 {
     return(WithDefaultMemoryCache(configurationSourceConfigurator, () => new CacheItemPolicy()
     {
         AbsoluteExpiration = DateTimeOffset.UtcNow.Add(expiresAfter)
     }));
 }
Example #2
0
 public static IConfigurationConfigurator WithKeyPostfixer(this IConfigurationSourceConfigurator configuration, string postfix)
 {
     return(WithKeyFormatter(configuration, new KeyPostfixer(postfix)));
 }
Example #3
0
 public static IConfigurationConfigurator WithKeyFormatter(this IConfigurationSourceConfigurator configuration, IKeyFormatter keyFormatter)
 {
     return(configuration.WrapSource(x => new KeyFormatterConfigurationSourceDecorator(x, keyFormatter)));
 }
Example #4
0
 public static IConfigurationSourceConfigurator WithCache(this IConfigurationSourceConfigurator configurationSourceConfigurator, ICacheKeyCreator cacheKeyCreator, ObjectCache objectCache, Func <CacheItemPolicy> cacheItemPolicyFactory)
 {
     return(configurationSourceConfigurator.WrapSource(x => new CachingConfigurationSourceDecorator(x, cacheKeyCreator, objectCache, cacheItemPolicyFactory)));
 }
Example #5
0
 public static IConfigurationSourceConfigurator WithDefaultMemoryCache(this IConfigurationSourceConfigurator configurationSourceConfigurator, Func <CacheItemPolicy> cacheItemPolicyFactory)
 {
     return(WithCache(configurationSourceConfigurator, MemoryCache.Default, cacheItemPolicyFactory));
 }
Example #6
0
        public static IConfigurationSourceConfigurator WithCache(this IConfigurationSourceConfigurator configurationSourceConfigurator, ObjectCache objectCache, Func <CacheItemPolicy> cacheItemPolicyFactory)
        {
            var cacheKeyCreator = new CacheKeyCreator(Guid.NewGuid().ToString());

            return(WithCache(configurationSourceConfigurator, cacheKeyCreator, objectCache, cacheItemPolicyFactory));
        }