CompactionStrategy.CompactAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Evaluates the Trigger and, when it fires, delegates to CompactCoreAsync(CompactionMessageIndex, ILogger, CancellationToken) and reports compaction metrics.
public System.Threading.Tasks.ValueTask<bool> CompactAsync(Microsoft.Agents.AI.Compaction.CompactionMessageIndex index, Microsoft.Extensions.Logging.ILogger? logger = default, System.Threading.CancellationToken cancellationToken = default);
member this.CompactAsync : Microsoft.Agents.AI.Compaction.CompactionMessageIndex * Microsoft.Extensions.Logging.ILogger * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<bool>
Public Function CompactAsync (index As CompactionMessageIndex, Optional logger As ILogger = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of Boolean)
Parameters
- index
- CompactionMessageIndex
The message index to compact. The strategy mutates this collection in place.
- logger
- ILogger
An optional ILogger for emitting compaction diagnostics. When null, logging is disabled.
- cancellationToken
- CancellationToken
The CancellationToken to monitor for cancellation requests.
Returns
A task representing the asynchronous operation. The task result is true if compaction occurred, false otherwise.