Пример #1
0
        /// <summary>
        /// warning: CacheSuppress value of 'RecursiveAllDownstreamServices' will cause all downstream services to not use caching and might cause them performance issues.
        /// It should be used sparingly.
        /// </summary>
        public static IDisposable SuppressCaching(CacheSuppress cacheSuppress)
        {
            var prevCacheSuppress = CacheSuppress;

            CacheSuppress = cacheSuppress;

            return(new DisposableAction <CacheSuppress?>(prevCacheSuppress, x => CacheSuppress = x));
        }
Пример #2
0
        /// <summary>
        /// warning: CacheSuppress value of 'RecursiveAllDownstreamServices' will cause all downstream services to not use caching and might cause them performance issues.
        /// It should be used sparingly.
        /// </summary>
        public static IDisposable SuppressCaching(CacheSuppress cacheSuppress)
        {
            var overrides = (RequestOverrides)Implementation.Get(OVERRIDES_KEY);

            if (overrides == null)
            {
                overrides = new RequestOverrides();
                Implementation.Set(OVERRIDES_KEY, overrides);
            }

            var prevCacheSuppress = overrides.SuppressCaching;

            overrides.SuppressCaching = cacheSuppress;

            return(new DisposableAction <CacheSuppress?>(prevCacheSuppress, x =>
            {
                ((RequestOverrides)Implementation.Get(OVERRIDES_KEY)).SuppressCaching = x;
            }));
        }