Ejemplo n.º 1
0
        public static IServiceCollection AddSleepySharkCaching(this IServiceCollection services, Action <SleepySharkCachingOptions> setupAction)
        {
            if (setupAction == null)
            {
                throw new ArgumentNullException();
            }

            var options = new SleepySharkCachingOptions();

            setupAction(options);
            foreach (var serviceExtension in options.Extensions)
            {
                serviceExtension.AddServices(services);
            }
            services.AddSingleton(options);

            return(services);
        }
Ejemplo n.º 2
0
 public static SleepySharkCachingOptions UserInMemoryCache(this SleepySharkCachingOptions options, string name = _name)
 {
     options.RegisterExtension(new InMemoryCacheOptionExtensions(name));
     return(options);
 }