예제 #1
0
 public FileSystemContentBlobProvider(IOptions <FileSystemBlobContentOptions> options, IMemoryCache memoryCache)
 {
     _options     = options.Value;
     _memoryCache = memoryCache;
     //Create fileSystemWatcher instance only when rootFolder exist to prevent whole application crash on initialization phase.
     if (Directory.Exists(_options.Path))
     {
         _fileSystemWatcher = new PhysicalFilesWatcher(_options.Path, new FileSystemWatcher(_options.Path), _options.PollForChanges);
     }
 }
예제 #2
0
 public FileSystemContentBlobProvider(IOptions <FileSystemBlobContentOptions> options, IStorefrontMemoryCache memoryCache)
 {
     _options     = options.Value;
     _memoryCache = memoryCache;
     //Create fileSystemWatcher instance only when rootFolder exist to prevent whole application crash on initialization phase.
     if (Directory.Exists(_options.Path))
     {
         //It is very important to have rootPath with leading slash '\' without this any changes won't reflected
         var rootPath = _options.Path.TrimEnd('\\') + '\\';
         _fileSystemWatcher = new PhysicalFilesWatcher(rootPath, new FileSystemWatcher(rootPath), false);
     }
 }