Example #1
0
 public Cache(ILogger <Cache> logger, ILogger <CacheSync> syncLogger, IServiceProvider service, DistributeCacheConfig config)
 {
     this.service = service;
     this.config  = config;
     this.logger  = logger;
     this.caches  = new ConcurrentDictionary <string, CacheInfo>();
     redisClient  = new CSRedisClient(config.RedisConnectionString);
     this.sync    = new CacheSync(this, config);
 }
Example #2
0
 public CacheSync(Cache cache, DistributeCacheConfig config)
 {
     this.config = config;
     this.cache  = cache;
     redisClient = new CSRedisClient(config.RedisConnectionString);
     if (string.IsNullOrEmpty(config.SyncChannel) == false)
     {
         redisClient.Subscribe((
                                   config.SyncChannel,
                                   this.Sync));
     }
 }
Example #3
0
 public CacheInfo(DistributeCacheConfig config)
 {
     this.config     = config;
     this.ExpireTime = DateTime.Now.AddSeconds(this.config.ExpireSeconds);
 }