DistributedCacheRegistration(StackTrace stackTrace, string name, DistributedCacheEntryOptions entryOptions, CacheItemBuilder builder, CacheItemBuilderAsync builderAsync, Func <object, object[], string[]> cacheTags) { if (builder == null && builderAsync == null) { throw new ArgumentNullException(nameof(builder)); } var parentName = stackTrace.GetFrame(1).GetMethod().DeclaringType.FullName; Name = $"{parentName}:{name}"; EntryOptions = entryOptions ?? new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(90)); Builder = builder; BuilderAsync = builderAsync; CacheTags = cacheTags; }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The key.</param> /// <param name="itemPolicy">The item policy.</param> /// <param name="builder">The builder.</param> public ServiceCacheRegistration(string name, CacheItemPolicy itemPolicy, CacheItemBuilder builder) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } if (itemPolicy == null) { throw new ArgumentNullException("itemPolicy"); } if (builder == null) { throw new ArgumentNullException("builder"); } Name = name; Builder = builder; ItemPolicy = itemPolicy; Namespaces = new List <string>(); }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The name.</param> /// <param name="itemPolicy">The cache command.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The dependency array.</param> public ServiceCacheRegistration(string name, CacheItemPolicy itemPolicy, CacheItemBuilder builder, params string[] cacheTags) : this(name, itemPolicy, builder) { SetItemPolicyDependency(cacheTags); }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The key.</param> /// <param name="minuteTimeout">The minute timeout.</param> /// <param name="builder">The builder.</param> /// <param name="dependency">The dependency.</param> public ServiceCacheRegistration(string name, int minuteTimeout, CacheItemBuilder builder, CacheItemDependency dependency) : this(name, new CacheItemPolicy(minuteTimeout), builder) { SetItemPolicyDependency(dependency); }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The key.</param> /// <param name="minuteTimeout">The minute timeout.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The dependency array.</param> public ServiceCacheRegistration(string name, int minuteTimeout, CacheItemBuilder builder, Func <object, object[], string[]> cacheTags) : this(name, new CacheItemPolicy(minuteTimeout), builder) { SetItemPolicyDependency(cacheTags); }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The key.</param> /// <param name="minuteTimeout">The minute timeout.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The dependency array.</param> public ServiceCacheRegistration(string name, int minuteTimeout, CacheItemBuilder builder, params string[] cacheTags) : this(name, new CacheItemPolicy(minuteTimeout), builder) { SetItemPolicyDependency(cacheTags); }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The key.</param> /// <param name="builder">The builder.</param> public ServiceCacheRegistration(string name, CacheItemBuilder builder) : this(name, new CacheItemPolicy(), builder) { }
/// <summary> /// Registers the specified registration. /// </summary> /// <param name="name">The registration name.</param> /// <param name="itemPolicy">The cache command.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public void Register(string name, CacheItemPolicy itemPolicy, CacheItemBuilder builder, params string[] cacheTags) { Register(new ServiceCacheRegistration(name, itemPolicy, builder, cacheTags)); }
/// <summary> /// Initializes a new instance of the <see cref="DistributedCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="minuteTimeout">The minute timeout.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public DistributedCacheRegistration(string name, int minuteTimeout, CacheItemBuilder builder, Func <object, object[], string[]> cacheTags) : this(new StackTrace(), name, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), builder, null, cacheTags) { }
/// <summary> /// Initializes a new instance of the <see cref="DistributedCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="minuteTimeout">The minute timeout.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public DistributedCacheRegistration(string name, int minuteTimeout, CacheItemBuilder builder, params string[] cacheTags) : this(new StackTrace(), name, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), builder, null, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null) { }
/// <summary> /// Initializes a new instance of the <see cref="DistributedCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="entryOptions">The entry options.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public DistributedCacheRegistration(string name, DistributedCacheEntryOptions entryOptions, CacheItemBuilder builder, params string[] cacheTags) : this(new StackTrace(), name, entryOptions, builder, null, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null) { }
/// <summary> /// Initializes a new instance of the <see cref="MemoryCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public MemoryCacheRegistration(string name, CacheItemBuilder builder, Func <object, object[], string[]> cacheTags) : this(new StackTrace(), name, null, builder, null, cacheTags) { }
/// <summary> /// Initializes a new instance of the <see cref="MemoryCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public MemoryCacheRegistration(string name, CacheItemBuilder builder, params string[] cacheTags) : this(new StackTrace(), name, null, builder, null, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null) { }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The name.</param> /// <param name="itemPolicy">The cache command.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The dependency array.</param> public ServiceCacheRegistration(string name, CacheItemPolicy itemPolicy, CacheItemBuilder builder, Func <object, object[], string[]> cacheTags) : this(name, itemPolicy, builder) { SetItemPolicyDependency(cacheTags); }
/// <summary> /// Initializes a new instance of the <see cref="DistributedCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="entryOptions">The entry options.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public DistributedCacheRegistration(string name, DistributedCacheEntryOptions entryOptions, CacheItemBuilder builder, Func <object, object[], string[]> cacheTags) : this(new StackTrace(), name, entryOptions, builder, null, cacheTags) { }
/// <summary> /// Adds the data source. /// </summary> /// <param name="name">The name.</param> /// <param name="itemPolicy">The cache command.</param> /// <param name="builder">The builder.</param> /// <param name="dependency">The dependency.</param> public ServiceCacheRegistration(string name, CacheItemPolicy itemPolicy, CacheItemBuilder builder, CacheItemDependency dependency) : this(name, itemPolicy, builder) { SetItemPolicyDependency(dependency); }
/// <summary> /// Registers the specified registration. /// </summary> /// <param name="name">The registration name.</param> /// <param name="minuteTimeout">The minute timeout.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public void Register(string name, int minuteTimeout, CacheItemBuilder builder, params string[] cacheTags) { Register(new ServiceCacheRegistration(name, new CacheItemPolicy(minuteTimeout), builder, cacheTags)); }