@@ -12,6 +12,24 @@ namespace Soenneker.Utils.HttpClientCache.Abstract;
1212/// </summary>
1313public interface IHttpClientCache : IAsyncDisposable , IDisposable
1414{
15+ /// <summary>
16+ /// Retrieves an <see cref="HttpClient"/> with default options.
17+ /// </summary>
18+ /// <param name="id">The cache key</param>
19+ /// <param name="cancellationToken"></param>
20+ [ Pure ]
21+ ValueTask < HttpClient > Get ( string id , CancellationToken cancellationToken = default ) ;
22+
23+ /// <summary>
24+ /// Retrieves an <see cref="HttpClient"/> using an asynchronous factory to provide <see cref="HttpClientOptions"/>.
25+ /// Factory is only invoked if the client doesn't exist in the cache.
26+ /// </summary>
27+ /// <param name="id">The cache key</param>
28+ /// <param name="optionsFactory">An asynchronous delegate that returns the options</param>
29+ /// <param name="cancellationToken"></param>
30+ [ Pure ]
31+ ValueTask < HttpClient > Get ( string id , Func < CancellationToken , ValueTask < HttpClientOptions ? > > optionsFactory , CancellationToken cancellationToken = default ) ;
32+
1533 /// <summary>
1634 /// Retrieves an <see cref="HttpClient"/> using a synchronous factory to provide <see cref="HttpClientOptions"/>.
1735 /// Factory is only invoked if the client doesn't exist in the cache.
@@ -32,6 +50,31 @@ public interface IHttpClientCache : IAsyncDisposable, IDisposable
3250 [ Pure ]
3351 ValueTask < HttpClient > Get ( string id , Func < ValueTask < HttpClientOptions ? > > optionsFactory , CancellationToken cancellationToken = default ) ;
3452
53+ /// <summary>
54+ /// Retrieves an <see cref="HttpClient"/> with default options synchronously.
55+ /// </summary>
56+ /// <param name="id">The cache key</param>
57+ /// <param name="cancellationToken"></param>
58+ [ Pure ]
59+ HttpClient GetSync ( string id , CancellationToken cancellationToken = default ) ;
60+
61+ /// <summary>
62+ /// Retrieves an <see cref="HttpClient"/> using an asynchronous factory to provide <see cref="HttpClientOptions"/> synchronously.
63+ /// Factory is only invoked if the client doesn't exist in the cache.
64+ /// </summary>
65+ /// <param name="id">The cache key</param>
66+ /// <param name="optionsFactory">An asynchronous delegate that returns the options</param>
67+ /// <param name="cancellationToken"></param>
68+ [ Pure ]
69+ HttpClient GetSync ( string id , Func < CancellationToken , ValueTask < HttpClientOptions ? > > optionsFactory , CancellationToken cancellationToken = default ) ;
70+
71+ /// <summary>
72+ /// Retrieves an <see cref="HttpClient"/> using a synchronous factory to provide <see cref="HttpClientOptions"/> synchronously.
73+ /// Factory is only invoked if the client doesn't exist in the cache.
74+ /// </summary>
75+ /// <param name="id">The cache key</param>
76+ /// <param name="optionsFactory">A synchronous delegate that returns the options</param>
77+ /// <param name="cancellationToken"></param>
3578 [ Pure ]
3679 HttpClient GetSync ( string id , Func < HttpClientOptions ? > optionsFactory , CancellationToken cancellationToken = default ) ;
3780
0 commit comments