public ICacheProvider GetClient(CacheTargetType cacheTargetType = CacheTargetType.Redis, string sectionName = "RedisConfig") { switch (cacheTargetType) { case CacheTargetType.Redis: { var redisClient = GetRedisClient(sectionName); if (redisClient == null) { return(null); } return(new RedisProvider(redisClient)); } default: { var redisClient = GetRedisClient(sectionName); if (redisClient == null) { return(null); } return(new RedisProvider(redisClient)); } } }
static CacheFactory() { if (!string.IsNullOrEmpty(CPlatformAppConfig.CacheSectionOptions.CacheSectionName)) { cacheSectionName = CPlatformAppConfig.CacheSectionOptions.CacheSectionName; } if (CPlatformAppConfig.CacheSectionOptions.CacheType != cacheType) { cacheType = CPlatformAppConfig.CacheSectionOptions.CacheType; } }
public static ServiceDescriptor Mode(this ServiceDescriptor descriptor, CacheTargetType cacheTargetType, string metadataId) { var metadata = GetInterceptMetadata(descriptor, metadataId); var targetType = Convert.ToInt32(cacheTargetType).ToString(); if (string.IsNullOrEmpty(metadata.Item1)) { metadata.Item1 = targetType; } else { metadata.Item1 += $"|{targetType}"; } metadata.Item2[metadataId] = metadata.Item1; descriptor.Metadatas["Intercept"] = metadata.Item2; return(descriptor); }
public IdentifyCacheAttribute(CacheTargetType name) { this.Name = name; }