Ejemplo n.º 1
0
        internal static RedisCachingService GetCustomRedis(
            bool?useBasic = null,
            string configurationOptions                 = null,
            int?defaultScanPageSize                     = null,
            bool?compressValues                         = null,
            CacheInfo cacheInfo                         = null,
            Guid?cacheProviderSettingsId                = null,
            int?defaultExpireTimeSpanSeconds            = null,
            string redisServiceImplementationTypeString = null)
        {
            ICacheProviderSettings defaultSettings = GetCacheProviderSettings(compressValues);
            RedisServiceSettings   settings        = new RedisServiceSettings
            {
                ConfigurationOptions                 = configurationOptions ?? defaultSettings.ServiceSettings.ConfigurationOptions,
                DefaultScanPageSize                  = defaultScanPageSize ?? defaultSettings.ServiceSettings.DefaultScanPageSize,
                CompressValues                       = compressValues ?? defaultSettings.ServiceSettings.CompressValues,
                ProviderInfo                         = cacheInfo ?? defaultSettings.ServiceSettings.ProviderInfo,
                CacheProviderSettingsIdString        = (cacheProviderSettingsId ?? defaultSettings.ServiceSettings.CacheProviderSettingsId).ToString(),
                DefaultExpireTimeSpanSeconds         = defaultExpireTimeSpanSeconds ?? (int?)defaultSettings.ServiceSettings.DefaultExpireTimeSpan?.TotalSeconds ?? 3600,
                RedisServiceImplementationTypeString = redisServiceImplementationTypeString ?? defaultSettings.ServiceSettings.RedisServiceImplementationType.ToString()
            };

            RedisProviderSettings configuration = new RedisProviderSettings(SerializationService, settings, SerializationSettings);

            return(new RedisCachingService(configuration, GenerateLoggingService().Object));
        }
Ejemplo n.º 2
0
        internal static ICacheProviderSettings GetCacheProviderSettings(bool?compressValues = null, bool?useBasic = null)
        {
            RedisServiceSettings settings = null;

            if (compressValues ?? false)
            {
                if (useBasic ?? false)
                {
                    TestRedisConfigurationBasic config = ConfigurationService.GetConfiguration <TestRedisConfigurationBasic, TestRedisConfigurationMetadataBasic>();
                    settings = config.RedisSettings;
                }
                else
                {
                    TestRedisConfiguration config = ConfigurationService.GetConfiguration <TestRedisConfiguration, TestRedisConfigurationMetadata>();
                    settings = config.RedisSettings;
                }
            }
            else
            {
                if (useBasic ?? false)
                {
                    TestRedisConfigurationNoCompressBasic config = ConfigurationService.GetConfiguration <TestRedisConfigurationNoCompressBasic, TestRedisConfigurationMetadataNoCompressBasic>();
                    settings = config.RedisSettings;
                }
                else
                {
                    TestRedisConfigurationNoCompress config = ConfigurationService.GetConfiguration <TestRedisConfigurationNoCompress, TestRedisConfigurationMetadataNoCompress>();
                    settings = config.RedisSettings;
                }
            }
            RedisProviderSettings configuration = new RedisProviderSettings(SerializationService, settings, SerializationSettings);

            return(configuration);
        }