public CachingProfileService(TProfileService inner, ICache <IsActiveContextCacheEntry> cache, ProfileServiceCachingOptions <TProfileService> options, ILogger <CachingProfileService <TProfileService> > logger) { this.inner = inner; this.logger = logger; this.cache = cache; this.options = options; }
///<summary> /// Add Redis caching for IProfileService Implementation /// </summary> /// <param name="builder"></param> /// <param name="optionsBuilder">Profile Service Redis Cache Options builder</param> /// <returns></returns> public static IIdentityServerBuilder AddProfileServiceCache <TProfileService>(this IIdentityServerBuilder builder, Action <ProfileServiceCachingOptions <TProfileService> > optionsBuilder = null) where TProfileService : class, IProfileService { var options = new ProfileServiceCachingOptions <TProfileService>(); optionsBuilder?.Invoke(options); builder.Services.AddSingleton(options); builder.Services.TryAddTransient(typeof(TProfileService)); builder.Services.AddTransient <IProfileService, CachingProfileService <TProfileService> >(); return(builder); }
public CachingProfileService( TProfileService inner, ICache <IsActiveContextCacheEntry> cache, ProfileServiceCachingOptions <TProfileService> options, ILogger <CachingProfileService <TProfileService> > logger) { this.inner = inner; this.logger = logger; this.cache = cache; this.options = options; _keySelector = options.KeySelector; _keyPrefix = options.KeyPrefix; _shouldCache = options.ShouldCache; _expiration = options.Expiration; }