Asp.net Cache Cache Data on Client

We would like to cache data for some drop-down lists on the client machine in order to reduce the transmission of slow information. This data will be used on several pages in a business application, therefore, for example, a customer list of 5,000 customers is often used to search, create a sales order, or for other purposes. We tried both full data loading with the page, and access to the database on demand and loading the grid on demand, which returns only 25-50 records. Users complain about the performance of both parameters and want faster, so we are looking for options for caching data on the client for reuse.

We saw some records that online access to caching, perhaps a JS file can be generated by the server and localized to be a data source for ddl, but we did not find how to do it.

Any suggestions? Or other options that you would recommend?

Note: we will also need to fix this, as some of the lists will change several times a day and need to be updated (not by timer, but when they change depending on the response code).

+3
source share
2 answers

, , , (, , ""?), , .

  • ? OutputCache (, ) .

  • ? firebug fiddler , . HTTP- ( CSS javascripts, ) .

  • ViewState? , ViewState .

  • ? , , , .

, , , , .

+3

javascript, JSON script , JSON, - jQuery javascript .

. html/aspx:

<script src="CustomerList.aspx?Refresh=12308798798023745" type="text/javascript"></script>

- DateTime.Now.Ticks , . , , , .

- :

public class Cache {
  public static List<Customer> Customers { get; set; }
  public static DateTime LastRefresh { get; set; }
  public static void RefreshCustomers {
    //Populate Customers, Customers = blah;
    LastRefresh = DateTime.Now;
  }
}

:

ScriptTagwithRunAtServer.Src = "CustomerList.aspx?Refresh=" + Cache.LastRefresh.Ticks;

, . CustomerList.aspx Cache.Customers json-... javascript, .

, , , , - .

+2

Source: https://habr.com/ru/post/1731642/


All Articles