public TransitioningGlobalCacheStore(RedisContentLocationStoreConfiguration configuration, IGlobalCacheStore redisStore, IGlobalCacheStore distributedStore) { Contract.Requires(configuration.AllContentMetadataStoreModeFlags.HasAnyFlag(ContentMetadataStoreModeFlags.Redis) && configuration.AllContentMetadataStoreModeFlags.HasAnyFlag(ContentMetadataStoreModeFlags.Distributed), "Transitioning store should not used for cases where one store or the other is used exclusively"); _configuration = configuration; _redisStore = redisStore; _distributedStore = distributedStore; if (BlobMode.HasAllFlags(ContentMetadataStoreModeFlags.PreferRedis) || BlobMode.MaskFlags(ContentMetadataStoreModeFlags.Distributed) == 0) { AreBlobsSupported = _redisStore.AreBlobsSupported; } else if (BlobMode.HasAllFlags(ContentMetadataStoreModeFlags.PreferDistributed) || BlobMode.MaskFlags(ContentMetadataStoreModeFlags.Redis) == 0) { AreBlobsSupported = _distributedStore.AreBlobsSupported; } else { AreBlobsSupported = _redisStore.AreBlobsSupported || _distributedStore.AreBlobsSupported; } // Mask used to only include valid flags for BlobMode based on blob support in the respective stores _blobSupportedMask = ContentMetadataStoreModeFlags.All .Subtract(_redisStore.AreBlobsSupported ? 0 : ContentMetadataStoreModeFlags.Redis | ContentMetadataStoreModeFlags.PreferRedis) .Subtract(_distributedStore.AreBlobsSupported ? 0 : ContentMetadataStoreModeFlags.Distributed | ContentMetadataStoreModeFlags.PreferDistributed); }
/// <nodoc /> public MetadataStoreMemoizationDatabase(IGlobalCacheStore store) { _store = store; LinkLifetime(store); }