zkdoe001のブログ

zkdoe001のブログ

ブログの説明を入力します。

Amebaでブログを始めよう!

How to cache data http://www.bruinsofficialprostore.com/Authentic-Reilly-Smith-Jersey in a MVC application

I have read lots of information about page caching and partial Women's Jarome Iginla Jersey page caching in a MVC application. However, I Jarome Iginla Jersey would like to know how you would cache data.

In my scenario I will be using LINQ to Entities (entity framework). On the first call to GetNames (or whatever the method is) I want to grab the Reilly Smith Jersey data from the database. I want to save the results in cache and on the second call to use the cached version if it exists. But this example is different to the first Oli is referring to, because he doesn access the cache again the problem is that just doing: return (string[])Cache["names"]; . COULD result in a null value being returned, because it COULD have expired. It not likely, but it can happen. By using this pattern you get caching without your existing code seeing any of the caching logic. Essentially you use the cached repository as if it were any other repository.