public DataOceanFolderCache(IMemoryCache memoryCache, string dataOceanRootFolderId) { _cache = memoryCache; var rootDataOceanFolderPath = new DataOceanFolderPath(dataOceanRootFolderId, new Dictionary <string, DataOceanFolderPath>()); lock (_cache) { if (!_cache.TryGetValue <string>(dataOceanRootFolderId, out _)) { _cache.Set(dataOceanRootFolderId, rootDataOceanFolderPath); } } }
public DataOceanFolderPath CreateNode(string parentId, string folderName) { var folderPath = new DataOceanFolderPath(parentId, new Dictionary <string, DataOceanFolderPath>()); lock (Nodes) { if (Nodes.TryGetValue(folderName, out var retrievedCurrentDataOceanFolderPath)) { return(retrievedCurrentDataOceanFolderPath); } Nodes.Add(folderName, folderPath); return(folderPath); } }