Share via


ClientCache.GetClient<T>(Object, Func<T>) Method

Definition

Retrieves a client from the cache or creates a new one if it doesn't exist. Updates the last-used timestamp on every hit.

public T GetClient<T>(object clientId, Func<T> createClient) where T : class;
member this.GetClient : obj * Func<'T (requires 'T : null)> -> 'T (requires 'T : null)
Public Function GetClient(Of T As Class) (clientId As Object, createClient As Func(Of T)) As T

Type Parameters

T

The type of the client.

Parameters

clientId
Object

A key representing the client configuration.

createClient
Func<T>

A factory function to create the client if not cached.

Returns

T

The cached or newly created client instance.

Applies to