internal IDsDocument?Find(IDsDocumentNameKey key, bool checkTempCache) { IDsDocument doc; rwLock.EnterReadLock(); try { doc = Find_NoLock(key).Document; } finally { rwLock.ExitReadLock(); } if (doc is not null) { return(doc); } if (checkTempCache) { lock (tempCacheLock) { foreach (var document in tempCache) { if (key.Equals(document.Key)) { return(document); } } } } return(null); }
IDsDocument Find_NoLock(IDsDocumentNameKey key) { Debug.Assert(key != null); if (key == null) { return(null); } foreach (var document in documents) { if (key.Equals(document.Key)) { return(document); } } return(null); }
IDsDocument Remove_NoLock(IDsDocumentNameKey key) { if (key == null) { return(null); } for (int i = 0; i < documents.Count; i++) { if (key.Equals(documents[i].Key)) { documents.RemoveAt(i); return(documents[i]); } } return(null); }