/// <summary>
 /// Uses the in-memory.
 /// </summary>
 /// <param name="options">Options.</param>
 /// <param name="filterMemoryOptions"></param>
 public static BloomFilterOptions UseInMemory(this BloomFilterOptions options, FilterMemoryOptions filterMemoryOptions)
 {
     if (filterMemoryOptions == null)
     {
         throw new ArgumentNullException(nameof(filterMemoryOptions));
     }
     options.RegisterExtension(new FilterMemoryOptionsExtension(filterMemoryOptions));
     return(options);
 }
示例#2
0
 /// <summary>
 /// Uses the EasyCaching redis.
 /// </summary>
 /// <param name="options">Options.</param>
 /// <param name="filterRedisOptions"></param>
 public static BloomFilterOptions UseEasyCachingRedis(this BloomFilterOptions options, FilterEasyCachingRedisOptions filterRedisOptions)
 {
     if (filterRedisOptions == null)
     {
         throw new ArgumentNullException(nameof(filterRedisOptions));
     }
     options.RegisterExtension(new FilterEasyCachingRedisExtension(filterRedisOptions));
     return(options);
 }
        /// <summary>
        /// Uses the in-memory.
        /// </summary>
        /// <param name="options">Options.</param>
        /// <param name="name"></param>
        /// <param name="setupActions"></param>
        public static BloomFilterOptions UseInMemory(this BloomFilterOptions options,
                                                     string name = BloomFilterConstValue.DefaultInMemoryName, Action <FilterMemoryOptions> setupActions = null)
        {
            var filterMemoryOptions = new FilterMemoryOptions
            {
                Name = name
            };

            setupActions?.Invoke(filterMemoryOptions);
            options.RegisterExtension(new FilterMemoryOptionsExtension(filterMemoryOptions));
            return(options);
        }
示例#4
0
        /// <summary>
        /// Uses the EasyCaching redis.
        /// </summary>
        /// <param name="options">Options.</param>
        /// <param name="name"></param>
        /// <param name="setupActions"></param>
        public static BloomFilterOptions UseEasyCachingRedis(this BloomFilterOptions options,
                                                             string name = BloomFilterConstValue.DefaultRedisName, Action <FilterEasyCachingRedisOptions> setupActions = null)
        {
            var filterRedisOptions = new FilterEasyCachingRedisOptions
            {
                Name = name
            };

            setupActions?.Invoke(filterRedisOptions);
            options.RegisterExtension(new FilterEasyCachingRedisExtension(filterRedisOptions));
            return(options);
        }