I am using Memorycache in blazer server. But same not working in Blazor client, getting resolve issue.
public PrcService(HttpClient httpClient,
IMemoryCache memoryCache,
IMapper mapper)
{
HttpClient = httpClient;
Mapper = mapper;
_memoryCache = memoryCache;
}
get data
public async Task<Registers> GetRegisters()
{
Registers output;
output = _memoryCache.Get<Registers>("aaa");
if (output == null)
{
var url = "/api/GetRegisters";
output = await GetJsonAsync<Registers>(url);
_memoryCache.Set("aaa", output, TimeSpan.FromHours(8));
}
return output;
}
error
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: CannotResolveService, Microsoft.Extensions.Caching.Memory.IMemoryCache, Invoicing.PrcInvoice.Service.PrcInvoiceService
System.InvalidOperationException: CannotResolveService, Microsoft.Extensions.Caching.Memory.IMemoryCache,