Web Reuse / Caching

I have a web application that retrieves data and displays the results. Due to the nature of the business, all business rules are included in the dll from which the web application must extract. Since there are several sites, and we do not want to include the main DLL in all the many applications that have been deployed, we combine any calls into the dll core into a web service. This helps when updating the base dll, which you need to click only one new application (i.e. Web service).

With this architect, I discovered that anyone who logs into any web application makes several calls to the database to get the data, which is then parsed. Information about the data in question is changing slowly, and I only need to update it, perhaps every 4-6 hours.

I am familiar with storing such things in a session when a user wants to see different representations of the same data type. However, the webservice is not actually applied with the session. What is a good method of caching data in a web service so that we do not make multiple expensive trips to the database.

The web service and applications are in C # and ASP.NET 2.0, and we use VS2005.

+3
source share
3 answers

( ), CacheDuration WebMethod arribute, -. :
CacheDuration

, ...

+3

, , memcached. Linux Windows, api #.

+1

# 1: - datatable. datatable . datatable -, , .

//pseudo-code

class MyWebMethods {

  private static DataTable localDataTable;
  static MyWebMethods() {
    localDataTable = new DataTable();
    //Do whatever else is needed here to populate the table
  }

  [WebMethod]
  public string GetSomeData(int id) {
    //Query localDataTable using parameter info
    //return result
  }
}

# 2: , ASP.Net(System.Web.Caching.Cache). , , .

+1
source

All Articles