예제 #1
0
        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);
        }
예제 #2
0
 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);
 }
예제 #3
0
        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);
        }