Caching in Client Side RRS feed

  • Question

  • Hi,

     I am using the win forms application. I am taking the records from Service.

    Its a large data and need to calculate , it will be using in the Grid.

    It takes much time.

    Again button click event i have to do same thing.

    I need to avoid this, so shall i store in the client side caching.

    How to use the client side caching , the datas holds in the dataset?

    next time i dont want to go to Db. I neet to get from client side caching.

    Thanks in Advance
    Friday, December 4, 2009 6:51 PM


  • Hi,

    You can declare a static variable and store the data in it.

    For example.

    public class StaticVariables
    public static DataTable dt=null;


    and in your method that you pull data from db you can use the code below.

    //select the data from db and assign it to StaticVariables.dt;
    return StaticVariables.dt;

    So everytime you call method if the variable is null data will be pulled from db. If it is not null data will be returned directly.

    And also if you want to invalidate data just setting the StaticVariables.dt=null will be enough.
    • Proposed as answer by Tamer Oz Tuesday, December 8, 2009 8:38 AM
    • Marked as answer by Jing0 Friday, December 11, 2009 6:22 AM
    Friday, December 4, 2009 7:22 PM