asp.net mvc 4 - Entity Framework only allow one query -


i making call sql database via entity framework, call takes 2 mins execute. want make sure call occurs once. once call made, place results in cache. notice if multiple users on site, can more 2 mins till data returned, whats best way approach this? should use mutex? or entity framework (version 4) have functionality built in handle type of situation. using mvc 4. thank you!

public ienumerable<adlisting> allactiveads() {     try     {     if (pullcache(constants.cachekeys.allactiveads) == null)     {         using (var db = new myentities())         {             db.commandtimeout = 300;              list<adlisting> results =                 (from in                      db.adlistings                        .include("adphotos")                        .include("tblocation")                  !a.deleted                  select a).tolist();              pushcache(results, constants.cachekeys.allactiveads);         }     }     return (list<adlisting>) pullcache(constants.cachekeys.allactiveads);     }     catch (exception ex)     {         handleexception(ex);         return null;     } } 


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -