AspNetCore.Docs.Samples/samples/WebKeyedService/Controllers/CustomServicesApiController.cs

18 lines
443 B
C#
Raw Normal View History

2023-09-14 11:00:09 +08:00
using Microsoft.AspNetCore.Mvc;
2023-09-14 11:00:09 +08:00
namespace WebKeyedService.Controllers;
[ApiController]
[Route("/cache")]
public class CustomServicesApiController : Controller
{
// GET /cache/big-cache
[HttpGet("big-cache")]
public ActionResult<object> GetOk([FromKeyedServices("big")]
ICache cache)
{
var data = cache.Get("data-mvc");
return cache.Get("data-mvc");
}
}