Collections
With Collections, objects are combined - both in the database and in transient memory. Collections can be created and modified with the following InstantView® commands:
- CreatePersCollection
- CreateTransCollection
- DeleteCollection
- ClearCollection
- AddIndex
- DropIndex
- Insert
- Cardinality
- GetElement
- link
- Unlink
It is an error to delete elements of a collection without removing them from it. Transient objects that are in transient collections are automatically protected from the garbage collection. This also means that the garbage collection iterates through all transient collections in each mark phase to check which objects are still referenced. This can lead to performance problems with transient collections with a large number of elements, and if the objects are protected elsewhere anyway (e.g. by a vector) or are only persistent, then this step can be deactivated for this collection via CX_GARBAGE_MANAGER::UnprotectContents.
Type | Description |
---|---|
SET (default) | No order, filters duplicate entries automatically, a little slower than LIST |
LIST | With order, allows double entries, is slightly faster than SET |
BAG | Out of order, allows duplicate entries so that objects can be removed multiple times. (Corresponds to a multiset) |
ARRAY | Behaves like LIST, but slower for modifications that do not take place at the end and faster than LIST when reading |
Caution: With SET and BAG , inserting clustered objects leads to enormous performance problems. See also: Clustering and Collections