Using REN.Kit’s Built-in Redis Cache Service
How to Use the Built-In Redis Cache
[Route("api/[controller]")]
[ApiController]
public class StandardCacheController(IRENCacheService cacheService) : ControllerBase
{
/// <summary>
/// Adds or updates an item in the Redis cache.
/// </summary>
[HttpPost("set")]
public async Task<IActionResult> SetCache([FromQuery] string key, [FromBody] object value)
{
await cacheService.SetAsync(key, value, TimeSpan.FromMinutes(10));
return Ok("Value cached in Redis.");
}
}
Supported Operations
Last updated