cache Dataset

Discussion in 'ASP .Net' started by Arthur Dzhelali, Jan 22, 2004.

  1. Is there any way to cache dataset on one page and it will be accessible for
    one user?

    if you declare dataset shared it will stay on the server and page will be
    able reference to it on reload, but in this case it will be shared with
    other users who use the page.
    Right now I found work around it by saving each dataset as xml file with
    users's sessionid in file name and reading it on page reload.

    is there a better way?
     
    Arthur Dzhelali, Jan 22, 2004
    #1
    1. Advertising

  2. Arthur Dzhelali

    Claudio Guest

    why not cache it in a session variable?

    Session.Contents["CachedDataSet"] = new DataSet();


    "Arthur Dzhelali" <> schrieb im Newsbeitrag
    news:Xns9478545987E0adzhelalithedaycom@216.168.3.44...
    > Is there any way to cache dataset on one page and it will be accessible

    for
    > one user?
    >
    > if you declare dataset shared it will stay on the server and page will be
    > able reference to it on reload, but in this case it will be shared with
    > other users who use the page.
    > Right now I found work around it by saving each dataset as xml file with
    > users's sessionid in file name and reading it on page reload.
    >
    > is there a better way?
    >
     
    Claudio, Jan 22, 2004
    #2
    1. Advertising

  3. I was trying to avoid session

    "Claudio" <> wrote in
    news::

    > why not cache it in a session variable?
    >
    > Session.Contents["CachedDataSet"] = new DataSet();
    >
    >
    > "Arthur Dzhelali" <> schrieb im Newsbeitrag
    > news:Xns9478545987E0adzhelalithedaycom@216.168.3.44...
    >> Is there any way to cache dataset on one page and it will be
    >> accessible

    > for
    >> one user?
    >>
    >> if you declare dataset shared it will stay on the server and page
    >> will be able reference to it on reload, but in this case it will be
    >> shared with other users who use the page.
    >> Right now I found work around it by saving each dataset as xml file
    >> with users's sessionid in file name and reading it on page reload.
    >>
    >> is there a better way?
    >>

    >
    >
    >
     
    Arthur Dzhelali, Jan 22, 2004
    #3
  4. Making anything Shared is something you should avoid unless it NEEDs to be
    Shared, as Shared classes remain in memory for the lifetime of the
    application. When talking about caching, it's best to think in terms of
    scope. What is the desired scope of the object? Is it supposed to be
    available to only one Page, one User, all Pages of one User, all Users?
    There are different types of cache for different scopes and situations. You
    stated that you want to cache it on one page. There is a cache that is
    available at Page scope, and that is ViewState. Forgive me if I review
    anything you already know here.

    ViewState is a Collection on the server side, but on the client it is a
    hidden form field. In other words, when you store something in the Page
    ViewState, it is stored as text in the WebForm on the client (in the
    browser). Because of this, objects stored in ViewState must be serializable
    (able to be translated into text). Fortunately, a DataSet is serializable,
    and you can safely store it in ViewState. The down side to using ViewState
    is the amount of data that you store there. Since ViewState is stored in a
    hidden form field on the client, the data must be sent to the browser with
    the HTML response. If there is a lot of data, it may take awhile for the
    page to load on the client, and awhile to pass back to the server (the data
    is in a hidden form field, so it gets posted back to the server).

    You also have the option of storing it in Session, as has been suggested.
    Apparently, you don't want to use Session State, although this is a
    perfectly good place to cache data that is global to all pages of a single
    User Session. The only things you have to be careful about when using
    Session State are (1) Making sure that you handle Session Timeouts, and (2)
    being careful not to load too much into User Sessions, as there will be that
    amount of memory allocated to each User Session.

    There are other caching mechanisms available, but for the scope which you're
    describing, I would think wither ViewState or Session State would be your
    best bets.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.


    "Arthur Dzhelali" <> wrote in message
    news:Xns9478545987E0adzhelalithedaycom@216.168.3.44...
    > Is there any way to cache dataset on one page and it will be accessible

    for
    > one user?
    >
    > if you declare dataset shared it will stay on the server and page will be
    > able reference to it on reload, but in this case it will be shared with
    > other users who use the page.
    > Right now I found work around it by saving each dataset as xml file with
    > users's sessionid in file name and reading it on page reload.
    >
    > is there a better way?
    >
     
    Kevin Spencer, Jan 22, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Nokes

    Cache::Cache Stale Segments

    Jeff Nokes, Sep 30, 2003, in forum: Perl
    Replies:
    0
    Views:
    598
    Jeff Nokes
    Sep 30, 2003
  2. DesignerX

    Page.Cache vs HttpContext.Current.Cache

    DesignerX, Jan 20, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    8,310
    vMike
    Jan 20, 2004
  3. =?Utf-8?B?b25l?=
    Replies:
    1
    Views:
    5,331
    Karl Seguin [MVP]
    Mar 8, 2006
  4. Sergey via DotNetMonster.com

    ASP.NET Cache vs Window System Cache

    Sergey via DotNetMonster.com, Nov 15, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    495
    Sergey via DotNetMonster.com
    Nov 15, 2006
  5. John
    Replies:
    2
    Views:
    1,206
Loading...

Share This Page