How to cache database tables to prevent many database queries in Asp.net C# mvc
MyModel model = MemoryCache.Default["my_model_key"] as MyModel;
if (model == null)
{
model = GetModelFromDatabase();
MemoryCache.Default["my_model_key"] = model;
}
// you could use the model here