Share via


DistributedCachingChatClient.GetCacheKey Method

Definition

Computes a cache key for the specified values.

protected:
 override System::String ^ GetCacheKey(System::Collections::Generic::IEnumerable<Microsoft::Extensions::AI::ChatMessage ^> ^ messages, Microsoft::Extensions::AI::ChatOptions ^ options, ReadOnlySpan<System::Object ^> additionalValues);
protected override string GetCacheKey(System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Extensions.AI.ChatOptions? options, scoped ReadOnlySpan<object?> additionalValues);
override this.GetCacheKey : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatOptions * ReadOnlySpan<obj> -> string
Protected Overrides Function GetCacheKey (messages As IEnumerable(Of ChatMessage), options As ChatOptions, additionalValues As ReadOnlySpan(Of Object)) As String

Parameters

messages
IEnumerable<ChatMessage>

The messages to inform the key.

options
ChatOptions

The ChatOptions to inform the key.

additionalValues
ReadOnlySpan<Object>

Any other values to inform the key.

Returns

The computed key.

Remarks

The messages, options, and additionalValues are serialized to JSON using JsonSerializerOptions in order to compute the key.

The generated cache key is not guaranteed to be stable across releases of the library.

Applies to