// ReSharper disable once MemberCanBeProtected.Global
        public DistributedCache(IDistributedCache cache, IOptions <DistributedCacheOptions> cacheOptions)
        {
            this.cache = cache
                         ?? throw new ArgumentException(
                                   "No distributed cache specified. Check for Microsoft.Extensions.Caching.* packages");

            this.cacheOptions = cacheOptions.Value;
        }
        public static DistributedCacheOptions UseSerialization(
            this DistributedCacheOptions options,
            Func <object, byte[]> serializer,
            Func <byte[], Type, object> deserializer)
        {
            options.Serializer   = serializer;
            options.Deserializer = deserializer;

            return(options);
        }