Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #cache #database #tables #prevent #database #queries #mvc
ADD COMMENT
Topic
Name
2+7 =