I have standard WebAPI methods like this. The methods use Entity Framework 6.1 to retrieve data from a SQL Server 2012 database:
[ResponseType(typeof(Content))]
public async Task<IHttpActionResult> Get(int id)
{
Content content = await db.Contents.FindAsync(id);
if (content == null)
{
return NotFound();
}
return Ok(content);
}
Is there a way that the response could be cached so it does not access the database every time?