コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        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);
            }
        }