示例#1
0
        public bool Store(PropertyDatabaseRecordKey recordKey, object value, bool sync)
        {
            using (LockUpgradeableRead())
            {
                var foundRecord = Find(recordKey, out var index);
                var insert      = true;
                if (foundRecord)
                {
                    var oldRecord = m_StoreData[(int)index];
                    if (oldRecord.value != null)
                    {
                        return(false);
                    }
                    insert = false;
                }

                var newRecord = new PropertyDatabaseVolatileRecord(recordKey, value);
                using (LockWrite())
                {
                    if (insert)
                    {
                        m_StoreData.Insert((int)index, newRecord);
                    }
                    else
                    {
                        m_StoreData[(int)index] = newRecord;
                    }
                    return(true);
                }
            }
        }
示例#2
0
 void InvalidateRange(BinarySearchRange binarySearchRange)
 {
     using (LockWrite())
     {
         for (var i = binarySearchRange.startOffset; i < binarySearchRange.endOffset; ++i)
         {
             var record    = m_StoreData[(int)i];
             var newRecord = new PropertyDatabaseVolatileRecord(record.key, record.recordValue.value, false);
             m_StoreData[(int)i] = newRecord;
         }
     }
 }
示例#3
0
 void InvalidateMaskRange(BinarySearchRange binarySearchRange, ulong documentKeyMask)
 {
     using (LockWrite())
     {
         for (var i = binarySearchRange.startOffset; i < binarySearchRange.endOffset; ++i)
         {
             var record = m_StoreData[(int)i];
             if ((record.key.documentKey & documentKeyMask) != 0)
             {
                 var newRecord = new PropertyDatabaseVolatileRecord(record.key, record.recordValue.value, false);
                 m_StoreData[(int)i] = newRecord;
             }
         }
     }
 }
示例#4
0
        public void Invalidate(PropertyDatabaseRecordKey recordKey, bool sync)
        {
            using (LockUpgradeableRead())
            {
                var foundRecord = Find(recordKey, out var index);
                if (!foundRecord)
                {
                    return;
                }

                using (LockWrite())
                {
                    var record    = m_StoreData[(int)index];
                    var newRecord = new PropertyDatabaseVolatileRecord(record.key, record.recordValue.value, false);
                    m_StoreData[(int)index] = newRecord;
                }
            }
        }
        public bool Store(PropertyDatabaseRecordKey recordKey, object value, bool sync)
        {
            using (LockUpgradeableRead())
            {
                var  foundRecord = Find(recordKey, out var index);
                bool insert      = !foundRecord;

                var newRecord = new PropertyDatabaseVolatileRecord(recordKey, value);
                using (LockWrite())
                {
                    if (insert)
                    {
                        m_StoreData.Insert((int)index, newRecord);
                    }
                    else
                    {
                        m_StoreData[(int)index] = newRecord;
                    }
                    return(true);
                }
            }
        }