Esempio n. 1
0
        /// <summary>
        /// Add file event to cache (won't add if already there so assured of only one occurrence)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FileSystemWatcherEx_Created(object sender, FileSystemEventArgs e)
        {
            _cacheItemPolicy.AbsoluteExpiration = DateTimeOffset.Now.AddSeconds(InitialCacheTimeSeconds);

            var fileData = new CacheFileInfo()
            {
                FileState  = FileCachedState.Busy,
                FilePath   = e.FullPath,
                RetryCount = 0,
                FileName   = e.Name,
                cachedTime = DateTime.Now
            };

            _memCache.AddOrGetExisting(e.Name, fileData, _cacheItemPolicy);
        }
Esempio n. 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="fileInfo"></param>
 public FileCacheStateInformedEventArg(CacheFileInfo fileInfo)
 {
     FileInfo = fileInfo;
 }