public CacheHandlerRegister WithHandler(ICacheHandler handler)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }

            if (_cacheHandlers.Contains(handler))
            {
                throw new InvalidOperationException(SR.HanderAlreadyExistsError);
            }

            _cacheHandlers.Add(handler);

            WithAsyncHitHandler <object>(handler.GetPriority(CacheHandlerType.Hit), async ctx =>
            {
                if (handler.Enabled)
                {
                    await handler.OnHit(ctx);
                }
            });

            WithAsyncMissHandler <object>(handler.GetPriority(CacheHandlerType.Miss), async ctx =>
            {
                if (handler.Enabled)
                {
                    await handler.OnMiss(ctx);
                }
            });

            WithAsyncStoreHandler <object>(handler.GetPriority(CacheHandlerType.Store), async ctx =>
            {
                if (handler.Enabled)
                {
                    await handler.OnStore(ctx);
                }
            });

            WithAsyncExpiringHandler(handler.GetPriority(CacheHandlerType.Expiring), async ctx =>
            {
                if (handler.Enabled)
                {
                    await handler.OnExpiring(ctx);
                }
            });

            WithAsyncExpiredHandler(handler.GetPriority(CacheHandlerType.Expired), async ctx =>
            {
                if (handler.Enabled)
                {
                    await handler.OnExpired(ctx);
                }
            });

            return(this);
        }