documentKeyMask | 文档键掩码。 |
使与文档键掩码匹配的多个文档中存储的所有属性失效。
此操作比简单的 IPropertyDatabaseView.Invalidate 慢,因为我们无法依赖二分查找来查找与掩码匹配的所有键。
using (var view = propertyDatabase.GetView()) { // Store properties of multiple documents. for (ulong i = 0; i < 10; ++i) { for (var j = 0; j < 10; ++j) view.Store(i, view.CreatePropertyHash($"prop{j}"), $"value{j}"); } // Invalidate all documents that match any set bits of the mask. ulong invalidatedDocumentMask = 2; view.InvalidateMask(invalidatedDocumentMask); // The invalidated documents can no longer be retrieved. for (ulong i = 0; i < 10; ++i) { if ((i & invalidatedDocumentMask) == 0) continue; if (view.TryLoad(i, out IEnumerable<object> invalidatedDocumentValues)) Assert.Fail("TryLoad should have failed to retrieve the invalidated document values."); } }