protected void AddToCache(AccountModelBase account, DirectoryModel directory) { if (directory == null) { throw new ArgumentNullException(nameof(directory)); } var hash = account.GetHashCode(); if (!string.IsNullOrEmpty(directory.Path)) { hash += directory.Path.GetHashCode(); } Cache.Set(hash, directory); }
protected DirectoryModel GetFromCache(AccountModelBase account, DirectoryModel directory) { var hash = account.GetHashCode(); if (directory != null) { hash += directory.GetHashCode(); } if (Cache.TryGetValue(hash, out DirectoryModel dir)) { return(dir); } return(null); }