예제 #1
0
 public CacheHandler(IMessageContext messageContext,
                     ILogger <CacheHandler> logger,
                     ICachedListsProvider cache,
                     IListsGateway listsGateway,
                     IFileSystem fileSystem,
                     IOptions <FileBasedCachedListsOptions> options)
 {
     this.messageContext = messageContext;
     this.logger         = logger;
     this.cache          = cache;
     this.listsGateway   = listsGateway;
     this.fileSystem     = fileSystem;
     this.options        = options.Value;
 }
예제 #2
0
 public FileBasedCachedListsProvider(IFileSystem fileSystem, IDistributedCache cache, IOptions <FileBasedCachedListsOptions> options)
 {
     this.fileSystem = fileSystem;
     this.cache      = cache;
     this.options    = options.Value;
     if (!fileSystem.Directory.Exists(this.options.CachePath))
     {
         fileSystem.Directory.CreateDirectory(this.options.CachePath);
         foreach (var file in fileSystem.Directory.GetFiles(sourceCsvFolder, "*.csv"))
         {
             fileSystem.File.Copy(file, fileSystem.Path.Combine(this.options.CachePath, fileSystem.Path.GetFileName(file)));
         }
     }
 }