/// <summary>
 /// Initializes a new instance of the <see cref="InternalSerializerDecorator" /> class.
 /// </summary>
 /// <param name="metrics">The metrics factory.</param>
 /// <param name="handler">The handler.</param>
 /// <param name="connectionInformation">The connection information.</param>
 public LinqCompilerDecorator(IMetrics metrics,
     ILinqCompiler handler,
     IConnectionInformation connectionInformation)
 {
     var name = handler.GetType().Name;
     _compileActionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileActionTimer", Units.Calls);
     _compileFunctionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileFunctionTimer", Units.Calls);
     _handler = handler;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="InternalSerializerDecorator" /> class.
        /// </summary>
        /// <param name="metrics">The metrics factory.</param>
        /// <param name="handler">The handler.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompilerDecorator(IMetrics metrics,
                                     ILinqCompiler handler,
                                     IConnectionInformation connectionInformation)
        {
            var name = handler.GetType().Name;

            _compileActionTimer   = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileActionTimer", Units.Calls);
            _compileFunctionTimer = metrics.Timer($"{connectionInformation.QueueName}.{name}.CompileFunctionTimer", Units.Calls);
            _handler = handler;
        }
        /// <summary>Initializes a new instance of the <see cref="LinqCompileCacheDecorator"/> class.</summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cacheProvider"></param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            MemoryCacheProvider cacheProvider,
            ICachePolicy <ILinqCompiler> cachePolicy,
            IMetrics metrics,
            IConnectionInformation connectionInformation)
        {
            _handler      = handler;
            _cacheActions = Policy.Cache <Action <object, object> >(cacheProvider, new SlidingTtl(cachePolicy.SlidingExpiration)
                                                                    , OnCacheGetAction, OnCacheMissAction, (context, s) => { }, (context, s, arg3) => { },
                                                                    (context, s, arg3) => { });

            var name = handler.GetType().Name;

            _counterActionCacheHit    = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss   = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class.
        /// </summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            ICacheManager <object> cache,
            ICachePolicy <ILinqCompiler> cachePolicy,
            IMetrics metrics,
            IConnectionInformation connectionInformation)
        {
            _handler    = handler;
            _cache      = cache;
            _itemPolicy = cachePolicy;
            var name = handler.GetType().Name;

            _counterActionCacheHit    = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss   = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);

            _counterFunctionCacheHit    = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHitCounter", Units.Items);
            _counterFunctionCacheMiss   = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items);
            _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="LinqCompileCacheDecorator" /> class.
        /// </summary>
        /// <param name="handler">The handler.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="cachePolicy">The cache policy.</param>
        /// <param name="metrics">The metrics.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public LinqCompileCacheDecorator(
            ILinqCompiler handler,
            ObjectCache cache,
            ICachePolicy<ILinqCompiler> cachePolicy,
            IMetrics metrics,
             IConnectionInformation connectionInformation)
        {
            _handler = handler;
            _cache = cache;
            _itemPolicy = new CacheItemPolicy {SlidingExpiration = cachePolicy.SlidingExpiration};
            var name = handler.GetType().Name;

            _counterActionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheHitCounter", Units.Items);
            _counterActionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionCacheMissCounter", Units.Items);
            _counterActionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqActionUniqueFlaggedCounter", Units.Items);

            _counterFunctionCacheHit = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheHiCountert", Units.Items);
            _counterFunctionCacheMiss = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionCacheMissCounter", Units.Items);
            _counterFunctionCacheUnique = metrics.Counter($"{connectionInformation.QueueName}.{name}.LinqFunctionUniqueFlaggedCounter", Units.Items);

        }