I'm having problems with the Cache now. For caching my DataTable I
tried the following:
1. Cache("myTable") = myTable
2. Cache.Insert("myTable", myTable")
And to access the table cached I tried the following:
1. myTable = Cache.Get("myTable")
2. myTable = Cache.Item("myTable")
However, in all cases, after a post back (by the click of a button)
myTable is Nothing. What is happening that myTable is losing its
values?
On Sep 25, 11:20 am, Andrew Badera <[email protected]> wrote:
> Access to the same information is one thing, but do they have
> different views of it? How often does the information change? On what
> basis do you refresh your cache?
>
> For a data view that has ANY kind of variability per-user or
> per-session or over session-lengths of time, Session is your best bet.
>
> Scaling issues come into play here because Application Cache and
> Session both live on a single server. If you have a farm, you may not
> know what server your user is going to be handled by. Load balancing
> with sticky sessions minimizes the risks here, but if a server goes
> down, you lose that Session and that Application Cache. Minimize use
> of these kinds of caching. State server is slightly better, but only
> as good as the state server itself. Database-based sessions are the
> most reliable and scale the best, but they're not the most performant.
> (Nor, for that matter, is a state server. Anything out-of-process is
> slower.)
>
> ∞ Andy Badera
> ∞ +1 518-641-1280
> ∞ This email is: [ ] bloggable [x] ask first [ ] private
> ∞ Google me:http://www.google.com/search?q=andrew%20badera
>
> On Fri, Sep 25, 2009 at 1:06 PM, Ana <[email protected]> wrote:
>
> > I still can't see which one is best in my case. The page I'm working
> > on now is to be used for a few people (maximum 3) and all of them have
> > access to the same information and he table will be used exclusively
> > in the page. I'm using Cache now. But is this the best solution?
>
> > Besides, what do you mean by "limits them when it comes to scaling"?
>
> > Thanks a lot, Andrew!
>
> > Ana
>
> > On Sep 25, 10:57 am, Andrew Badera <[email protected]> wrote:
> >> Cache is intended for something that will be used repeatedly
> >> throughout the application by different users. Session is intended for
> >> per-user data. Both caches (because that's what Session is too, it's
> >> little different than Application.Cache) have the same machine
> >> affinity that limits them when it comes to scaling.
>
> >> ∞ Andy Badera
> >> ∞ +1 518-641-1280
> >> ∞ This email is: [ ] bloggable [x] ask first [ ] private
> >> ∞ Google me:http://www.google.com/search?q=andrew%20badera
>
> >> On Fri, Sep 25, 2009 at 12:52 PM, Ana <[email protected]> wrote:
>
> >> > What about caching the table? Is this a good way to do it?
>
> >> > On Sep 25, 10:47 am, Andrew Badera <[email protected]> wrote:
> >> >> You _can_ put "anything" into Session. Beware possible (probable?)
> >> >> performance/scaling issues however.
>
> >> >> ∞ Andy Badera
> >> >> ∞ +1 518-641-1280
> >> >> ∞ This email is: [ ] bloggable [x] ask first [ ] private
> >> >> ∞ Google me:http://www.google.com/search?q=andrew%20badera
>
> >> >> On Fri, Sep 25, 2009 at 12:35 PM, Ana <[email protected]>
> >> >> wrote:
>
> >> >> > Hi,
>
> >> >> > I'm binding a Data Table based on the Directory Structure and in
> >> >> > information retrieved from the DB. First I add all records from the
> >> >> > Data Base into the table and then I go through each node of a TreeView
> >> >> > (the TreeView matches the Directory Structure) and, if a record is not
> >> >> > in the Data Base (and consequently in the table), I add it to the
> >> >> > table.
> >> >> > Because this is a quite slow operation and I need the table a lot of
> >> >> > times, I would like to keep this DataTable even after a post back
> >> >> > occurs. Is this something possible, or every time I have to re-bind
> >> >> > the table?
>
> >> >> > Thanks,
>
> >> >> > Ana