Cached JsonApiClient

Hello,

Since JsonApiClient is the recommended C# client, I would like to know if it supports caching. I see that there is an ApiCacheAsync method, but I couldn’t find a way to invalidate the cache.

Is there a recommended approach for manually clearing or invalidating cached responses when using ApiCacheAsync?

Thank you for your help!

Best regards,
Dejan

There’s no cache invalidation with ApiCacheAsync, it’s literally setting a singleton per type and returning the cached result if it’s already been called.

There wasn’t a cache client for JsonApiClient before but I’ve just added it which is now available in the latest v8.6.1+ pre-release packages.

It works the same as the JsonHttpClient where you can use the WithCache() extension method to return a client that supports caching, e.g:

var client = new JsonApiClient(baseUrl).WithCache(); 

//equivalent to:
var client = new CachedApiClient(new JsonApiClient(baseUrl));

Perfect as always! Thank you for your help.