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