public static FightBuilder ConfigureCacheing(this FightBuilder fightBuilder, Action <CachingBuilder> setupAction) { var builder = new CachingBuilder(fightBuilder.Services); setupAction?.Invoke(builder); builder.Build(); return(fightBuilder); }
/// <summary> /// Adds both Redis publisher and subscriber /// </summary> /// <remarks> /// These services expect <see cref="IConnectionMultiplexer"/> to be registered /// </remarks> /// <param name="builder">Messaging builder</param> /// <returns></returns> public static CachingBuilder UseRedisCache(this CachingBuilder builder, Action <CachingOptions> options) { builder.Services.Configure(options); builder.Services.AddSingleton <IRedisCacheProvider, RedisCacheDatabaseProvider>(); builder.Services.AddSingleton <ICacheManager, RedisCacheManager>(); builder.Services.AddSingleton <ICachingSerializer, JsonCachingSerializer>(); return(builder); }
public static CachingBuilder ConfigureQueryCaching(this CachingBuilder builder, CacheOptions defaultCacheOptions) { builder.Cache <GetCachedUserInfoQuery>() .InvalidatedBy <CreateUserCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <ApproveUserCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <LockUserCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <UnlockUserCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <ChangePasswordCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <RegisterUserActivityCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <DeleteUserCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <AddUsersToRolesCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <RemoveUsersFromRolesCommand, GetCachedUserInfoQueryInvalidatorInterceptor>() .InvalidatedBy <DeleteRoleCommand>() .WithSlidingExpiration(defaultCacheOptions.SlidingExpiration); return(builder); }