internal static IContentStore CreateLocalContentStore(
            DistributedContentSettings settings,
            DistributedCacheServiceArguments arguments,
            ResolvedNamedCacheSettings resolvedSettings,
            IDistributedLocationStore distributedStore = null)
        {
            settings = settings ?? DistributedContentSettings.CreateDisabled();
            var contentStoreSettings = FromDistributedSettings(settings);

            ConfigurationModel configurationModel
                = new ConfigurationModel(new ContentStoreConfiguration(new MaxSizeQuota(resolvedSettings.Settings.CacheSizeQuotaString)));

            var localStore = ContentStoreFactory.CreateContentStore(arguments.FileSystem, resolvedSettings.ResolvedCacheRootPath,
                                                                    contentStoreSettings: contentStoreSettings, distributedStore: distributedStore, configurationModel: configurationModel);

            if (settings.BackingGrpcPort != null)
            {
                var backingStore = new ServiceClientContentStore(
                    arguments.Logger,
                    arguments.FileSystem,
                    resolvedSettings.Name,
                    new ServiceClientRpcConfiguration(settings.BackingGrpcPort.Value),
                    arguments.Configuration.LocalCasSettings.CasClientSettings.RetryIntervalSecondsOnFailServiceCalls,
                    arguments.Configuration.LocalCasSettings.CasClientSettings.RetryCountOnFailServiceCalls,
                    scenario: settings.BackingScenario);

                return(new MultiLevelContentStore(localStore, backingStore));
            }

            return(localStore);
        }
示例#2
0
        public DistributedContentStore <AbsolutePath> CreateContentStore(ResolvedNamedCacheSettings resolvedSettings)
        {
            var contentStoreSettings = FromDistributedSettings(_distributedSettings);

            ConfigurationModel configurationModel = configurationModel
                                                        = new ConfigurationModel(new ContentStoreConfiguration(new MaxSizeQuota(resolvedSettings.Settings.CacheSizeQuotaString)));

            _logger.Debug("Creating a distributed content store");

            var contentStore =
                new DistributedContentStore <AbsolutePath>(
                    resolvedSettings.MachineLocation,
                    resolvedSettings.ResolvedCacheRootPath,
                    (checkLocal, distributedStore) =>
                    ContentStoreFactory.CreateContentStore(_fileSystem, resolvedSettings.ResolvedCacheRootPath,
                                                           contentStoreSettings: contentStoreSettings, distributedStore: distributedStore, configurationModel: configurationModel),
                    _redisMemoizationStoreFactory.Value,
                    _distributedContentStoreSettings,
                    distributedCopier: _copier,
                    clock: _arguments.Overrides.Clock,
                    contentStoreSettings: contentStoreSettings);

            _logger.Debug("Created Distributed content store.");
            return(contentStore);
        }
示例#3
0
        public IContentStore CreateFileSystemContentStore(ResolvedNamedCacheSettings resolvedCacheSettings, IDistributedLocationStore distributedStore)
        {
            var contentStoreSettings = FromDistributedSettings(_distributedSettings);

            ConfigurationModel configurationModel
                = new ConfigurationModel(new ContentStoreConfiguration(new MaxSizeQuota(resolvedCacheSettings.Settings.CacheSizeQuotaString)));

            return(ContentStoreFactory.CreateContentStore(_fileSystem, resolvedCacheSettings.ResolvedCacheRootPath,
                                                          contentStoreSettings: contentStoreSettings, distributedStore: distributedStore, configurationModel: configurationModel));
        }
示例#4
0
        public DistributedContentStore CreateDistributedContentStore(
            ResolvedNamedCacheSettings resolvedSettings,
            Func <IDistributedLocationStore, IContentStore> innerStoreFactory)
        {
            _logger.Debug("Creating a distributed content store");

            var contentStore =
                new DistributedContentStore(
                    resolvedSettings.MachineLocation,
                    resolvedSettings.ResolvedCacheRootPath,
                    distributedStore => innerStoreFactory(distributedStore),
                    _redisMemoizationStoreFactory.Value,
                    _distributedContentStoreSettings,
                    distributedCopier: _copier,
                    clock: _arguments.Overrides.Clock);

            _logger.Debug("Created Distributed content store.");
            return(contentStore);
        }
        public DistributedContentStore <AbsolutePath> CreateContentStore(ResolvedNamedCacheSettings resolvedSettings)
        {
            var contentStoreSettings = FromDistributedSettings(_distributedSettings);

            _logger.Debug("Creating a distributed content store");

            var contentStore =
                new DistributedContentStore <AbsolutePath>(
                    resolvedSettings.MachineLocation,
                    resolvedSettings.ResolvedCacheRootPath,
                    (checkLocal, distributedStore) => CreateLocalContentStore(_distributedSettings, _arguments, resolvedSettings, distributedStore),
                    _redisMemoizationStoreFactory.Value,
                    _distributedContentStoreSettings,
                    distributedCopier: _copier,
                    clock: _arguments.Overrides.Clock,
                    contentStoreSettings: contentStoreSettings);

            _logger.Debug("Created Distributed content store.");
            return(contentStore);
        }