Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisContentLocationStoreFactory"/> class.
        /// </summary>
        public RedisContentLocationStoreFactory(
            /*CanBeNull*/ IConnectionStringProvider contentConnectionStringProvider,
            /*CanBeNull*/ IConnectionStringProvider machineLocationConnectionStringProvider,
            IClock clock,
            TimeSpan contentHashBumpTime,
            RedisContentLocationStoreConfiguration configuration,
            IDistributedContentCopier copier)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(configuration.Keyspace));

            _contentConnectionStringProvider = contentConnectionStringProvider;
            _machineConnectionStringProvider = machineLocationConnectionStringProvider;
            Clock = clock;
            _contentHashBumpTime = contentHashBumpTime;
            _copier = copier;
            _lazyLocalLocationStore = new Lazy <LocalLocationStore>(() => CreateLocalLocationStore());
            Configuration           = configuration;

            if (Configuration.HasReadOrWriteMode(ContentLocationMode.Redis))
            {
                Contract.Assert(contentConnectionStringProvider != null, "When ReadFromRedis is on 'contentConnectionStringProvider' must not be null.");
                Contract.Assert(machineLocationConnectionStringProvider != null, "When ReadFromRedis is on 'machineLocationConnectionStringProvider' must not be null.");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisContentLocationStoreFactory"/> class.
        /// </summary>
        public RedisContentLocationStoreFactory(
            /*CanBeNull*/ IConnectionStringProvider contentConnectionStringProvider,
            /*CanBeNull*/ IConnectionStringProvider machineLocationConnectionStringProvider,
            IClock clock,
            TimeSpan contentHashBumpTime,
            string keySpace,
            byte[] localMachineLocation,
            IAbsFileSystem fileSystem = null,
            RedisContentLocationStoreConfiguration configuration = null)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(keySpace));

            _contentConnectionStringProvider = contentConnectionStringProvider;
            _machineConnectionStringProvider = machineLocationConnectionStringProvider;
            _clock = clock;
            _contentHashBumpTime  = contentHashBumpTime;
            _keySpace             = keySpace + Salt;
            _localMachineLocation = localMachineLocation;
            _configuration        = configuration ?? RedisContentLocationStoreConfiguration.Default;

            if (_configuration.HasReadOrWriteMode(ContentLocationMode.Redis))
            {
                Contract.Assert(contentConnectionStringProvider != null, "When ReadFromRedis is on 'contentConnectionStringProvider' must not be null.");
                Contract.Assert(machineLocationConnectionStringProvider != null, "When ReadFromRedis is on 'machineLocationConnectionStringProvider' must not be null.");
            }
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        protected RedisContentLocationStoreBase(IClock clock, RedisContentLocationStoreConfiguration configuration)
        {
            Contract.Requires(clock != null);

            _clock        = clock;
            configuration = configuration ?? RedisContentLocationStoreConfiguration.Default;
            Configuration = configuration;
        }
Ejemplo n.º 4
0
        public RedisBlobAdapter(RedisDatabaseAdapter redis, IClock clock, RedisContentLocationStoreConfiguration configuration)
        {
            _redis                 = redis;
            _blobExpiryTime        = TimeSpan.FromMinutes(configuration.BlobExpiryTimeMinutes);
            _capacityExpiryTime    = _blobExpiryTime.Add(TimeSpan.FromMinutes(5));
            _maxCapacityPerTimeBox = configuration.MaxBlobCapacity / 2;
            _clock                 = clock;

            _operationThrottle = new OperationThrottle(configuration.BlobOperationLimitSpan, configuration.BlobOperationLimitCount, clock);
        }
        public ContentLocationStoreFactory(
            ContentLocationStoreFactoryArguments arguments,
            RedisContentLocationStoreConfiguration configuration)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(configuration.Keyspace));
            Contract.Requires(arguments.Copier != null);

            Arguments     = arguments;
            Configuration = configuration;
            Services      = new ContentLocationStoreServices(arguments, configuration);
        }
 public ContentLocationStoreFactory(
     IClock clock,
     RedisContentLocationStoreConfiguration configuration,
     DistributedContentCopier copier)
     : this(
         new ContentLocationStoreFactoryArguments()
 {
     Clock = clock,
     Copier = copier
 },
         configuration)
 {
 }
        public ContentLocationStoreFactory(
            IClock clock,
            RedisContentLocationStoreConfiguration configuration,
            DistributedContentCopier copier)
        {
            Contract.Requires(configuration != null);
            Contract.Requires(!string.IsNullOrEmpty(configuration.RedisGlobalStoreConnectionString));
            Contract.Requires(!string.IsNullOrWhiteSpace(configuration.Keyspace));
            Contract.Requires(copier != null);

            Clock  = clock;
            Copier = copier;
            _lazyLocalLocationStore = new Lazy <LocalLocationStore>(() => CreateLocalLocationStore());
            Configuration           = configuration;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RedisContentLocationStoreFactory"/> class.
        /// </summary>
        public RedisContentLocationStoreFactory(
            IConnectionStringProvider contentConnectionStringProvider,
            IConnectionStringProvider machineLocationConnectionStringProvider,
            IClock clock,
            TimeSpan contentHashBumpTime,
            string keySpace,
            byte[] localMachineLocation,
            IAbsFileSystem fileSystem = null,
            RedisContentLocationStoreConfiguration configuration = null)
        {
            Contract.Requires(contentConnectionStringProvider != null);
            Contract.Requires(!string.IsNullOrWhiteSpace(keySpace));

            _contentConnectionStringProvider = contentConnectionStringProvider;
            _machineConnectionStringProvider = machineLocationConnectionStringProvider;
            _clock = clock;
            _contentHashBumpTime  = contentHashBumpTime;
            _keySpace             = keySpace + Salt;
            _localMachineLocation = localMachineLocation;
            _configuration        = configuration ?? RedisContentLocationStoreConfiguration.Default;
        }