示例#1
0
        internal DistributedCacheServiceArguments CreateDistributedCacheServiceArguments(
            IAbsolutePathFileCopier copier, IAbsolutePathTransformer pathTransformer, HostInfo host, string cacheName, string cacheRootPath, uint grpcPort, int maxSizeQuotaMB, string dataRootPath, CancellationToken ct, int?bufferSizeForGrpcCopies = null)
        {
            var distributedCacheServiceHost = new TestHost();

            var localCasSettings = LocalCasSettings.Default(
                maxSizeQuotaMB: maxSizeQuotaMB,
                cacheRootPath: cacheRootPath,
                cacheName: cacheName,
                grpcPort: grpcPort,
                grpcPortFileName: _scenario);

            localCasSettings.PreferredCacheDrive = Path.GetPathRoot(cacheRootPath);
            localCasSettings.ServiceSettings     = new LocalCasServiceSettings(60, scenarioName: _scenario, grpcPort: grpcPort, grpcPortFileName: _scenario, bufferSizeForGrpcCopies: bufferSizeForGrpcCopies);

            var redisConnectionString      = Environment.GetEnvironmentVariable(EnvironmentConnectionStringProvider.RedisConnectionStringEnvironmentVariable);
            var distributedContentSettings = DistributedContentSettings.CreateEnabled(new Dictionary <string, string>()
            {
                { host.StampId, redisConnectionString }
            });

            var config = new DistributedCacheServiceConfiguration(localCasSettings, distributedContentSettings);

            return(new DistributedCacheServiceArguments(_logger, copier, pathTransformer, distributedCacheServiceHost, host, ct, dataRootPath, config, null));
        }
示例#2
0
        public void ReadAndWriteSettings()
        {
            var dcs = DistributedContentSettings.CreateDisabled();

            TestSerializationRoundTrip(dcs);

            dcs = DistributedContentSettings.CreateEnabled(new Dictionary <string, string>(), true);
            TestSerializationRoundTrip(dcs);
        }