Wednesday, 20 September 2017

How to cache data in a MVC application

    public string[] GetNames()
    {
      string[] names = Cache["names"] as string[];
      if(names == null) //not in cache
      {
        names = DB.GetNames();
        Cache["names"] = names;
      }
      return names;
    }

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive