Pattern for caching data in Asp.Net Core + EF Core?
<p>I have an Asp.Net Core + EF Core REST service. I created a DbContext class for a DB I want to call a SP on. The method pretty much looks like:</p>

<pre><code>public IQueryable&lt;xxx&gt; Getxxxs()
{
    return Set&lt;xxx&gt;().FromSql("pr_Getxxx");
}
</code></pre>

<p>This all works, but there isn't any point in calling the SP every single time since the data the SP returns rarely changes. I'd like to make the data stale, say every 24 hours.</p>

<p>Is there a preferred pattern for doing that in Core? I see they have the .AddCaching extension method, but that seems like it would get injected into the controller? So its the controllers job to cache? I assume its thread-safe so I don't need to do any locking or anything like that? Seems like a race condition, if one thread is checking if the item is loaded into the cache, the other may be inserting it, etc?</p>