Exemplo n.º 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;
        }
Exemplo n.º 2
0
 public MemoryCacheRegistration(string name, MemoryCacheEntryOptions entryOptions, MemoryCacheItemBuilder builder, Func <object, object[], string[]> cacheTags)
     : this(new StackTrace(), name, entryOptions, builder, null, cacheTags)
 {
 }
Exemplo n.º 3
0
 public MemoryCacheRegistration(string name, int minuteTimeout, MemoryCacheItemBuilder builder, params string[] cacheTags)
     : this(new StackTrace(), name, new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), builder, null, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null)
 {
 }
Exemplo n.º 4
0
 public MemoryCacheRegistration(string name, int minuteTimeout, MemoryCacheItemBuilder builder, Func <object, object[], string[]> cacheTags)
     : this(new StackTrace(), name, new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromMinutes(minuteTimeout)), builder, null, cacheTags)
 {
 }
Exemplo n.º 5
0
 public MemoryCacheRegistration(string name, MemoryCacheEntryOptions entryOptions, MemoryCacheItemBuilder builder, params string[] cacheTags)
     : this(new StackTrace(), name, entryOptions, builder, null, cacheTags != null && cacheTags.Length > 0 ? (a, b) => cacheTags : (Func <object, object[], string[]>)null)
 {
 }