protected void AddToCache(ProviderModel provider, DirectoryModel directory) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } var hash = provider.GetHashCode(); if (!string.IsNullOrEmpty(directory.Path)) { hash += directory.Path.GetHashCode(); } _cache.Set(hash, directory); }
protected DirectoryModel GetFromCache(ProviderModel provider, string path) { var hash = provider.GetHashCode(); if (!string.IsNullOrEmpty(path)) { hash += path.GetHashCode(); } if (_cache.TryGetValue(hash, out DirectoryModel directory)) { return(directory); } return(null); }
protected DirectoryModel GetFromCache(ProviderModel provider, string path) { var hash = provider.GetHashCode(); if (!string.IsNullOrEmpty(path)) { hash += path.GetHashCode(); } if (_cache.ContainsKey(hash)) { return(_cache[hash]); } return(null); }
protected void AddToCache(ProviderModel provider, DirectoryModel directory) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } var hash = provider.GetHashCode(); if (!string.IsNullOrEmpty(directory.Path)) { hash += directory.Path.GetHashCode(); } if (_cache.ContainsKey(hash)) { _cache[hash] = directory; } else { _cache.Add(hash, directory); } }