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> /// Initializes a new instance of the <see cref="DistributedCacheRegistration"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="builder">The builder.</param> /// <param name="cacheTags">The cache tags.</param> public DistributedCacheRegistration(string name, CacheItemBuilderAsync builder, params string[] cacheTags) : this(new StackTrace(), name, null, null, builder, 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, CacheItemBuilderAsync builder, Func <object, object[], string[]> cacheTags) : this(new StackTrace(), name, entryOptions, null, 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, CacheItemBuilderAsync builder, Func <object, object[], string[]> cacheTags) : this(new StackTrace(), name, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), null, 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, CacheItemBuilderAsync builder, params string[] cacheTags) : this(new StackTrace(), name, new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), null, builder, 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, CacheItemBuilderAsync builder, Func <object, object[], string[]> cacheTags) : this(new StackTrace(), name, null, null, builder, cacheTags) { }
/// <summary> /// Initializes a new instance of the <see cref="MemoryCacheRegistration"/> 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 MemoryCacheRegistration(string name, MemoryCacheEntryOptions entryOptions, CacheItemBuilderAsync builder, params string[] cacheTags) : this(new StackTrace(), name, entryOptions, null, builder, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null) { }