Пример #1
0
        MemoryCacheRegistration(StackTrace stackTrace, string name, MemoryCacheEntryOptions entryOptions, MemoryCacheItemBuilder builder, MemoryCacheItemBuilderAsync 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 MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(90));
            Builder      = builder;
            BuilderAsync = builderAsync;
            CacheTags    = cacheTags;
        }
Пример #2
0
 public MemoryCacheRegistration(string name, MemoryCacheEntryOptions entryOptions, MemoryCacheItemBuilderAsync builder, Func <object, object[], string[]> cacheTags)
     : this(new StackTrace(), name, entryOptions, null, builder, cacheTags)
 {
 }
Пример #3
0
 public MemoryCacheRegistration(string name, int minuteTimeout, MemoryCacheItemBuilderAsync builder, params string[] cacheTags)
     : this(new StackTrace(), name, new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), null, builder, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null)
 {
 }
Пример #4
0
 public MemoryCacheRegistration(string name, int minuteTimeout, MemoryCacheItemBuilderAsync builder, Func <object, object[], string[]> cacheTags)
     : this(new StackTrace(), name, new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), null, builder, cacheTags)
 {
 }
Пример #5
0
 public MemoryCacheRegistration(string name, MemoryCacheEntryOptions entryOptions, MemoryCacheItemBuilderAsync builder, params string[] cacheTags)
     : this(new StackTrace(), name, entryOptions, null, builder, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null)
 {
 }