473,378 Members | 1,482 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Can I cache a DataTable in a Session object?

Can I cache a DataTable (or alternative GridView Datasource) in a
Session object?

.... and does the following scenario present itself as an occaison when
I could get away with doing so?

In an Asp.Net 2.0 app. I have a search results page. The results are
diplayed in a GridView with paging and sorting. In would prefer to get
all the data and do the paging/sorting in memory rather than adding to
the complexity of the T-SQL. It's not so much the paging that bothers
me as the sorting (that would be awful - I'd have to put the raw
results in a table variable first, then query the table variable to
get the paged/sorted results).

On any one day there are only about 100 clients who would use this web-
site (not concurrently). The site shares a server with an even less
busy site.

Q1: Am I right in thinking that this data should not be cached in the
Data Cache because each client will have entirely different search
results. (For instance, if two clients use the search page at the same
time that will lead to inconsistenty. - as the second client's data is
cached in the same Cache object as the first.)

Q2: Will it be possible to cache the DataSource for the GridView as
Session object instead? (assuming the above problems with the Data
Cache)

Q3: If I cache in the Session, apart from destroying the session
object (i.e the cached data) on leaving the page - are there any other
major considerations?

Q4: Would the DataSource need to be serializable for it to be storeded
as a session object?.

Jun 7 '07 #1
2 2104
On Jun 7, 2:08 pm, mark4asp <mark4...@gmail.comwrote:
Q1: Am I right in thinking that this data should not be cached in the
Data Cache because each client will have entirely different search
results. (For instance, if two clients use the search page at the same
time that will lead to inconsistenty. - as the second client's data is
cached in the same Cache object as the first.)
Yes, Cache is available to all users

Q2: Will it be possible to cache the DataSource for the GridView as
Session object instead? (assuming the above problems with the Data
Cache)
Yes

Q3: If I cache in the Session, apart from destroying the session
object (i.e the cached data) on leaving the page - are there any other
major considerations?
Session lives until the time specified for the session timeout

>
Q4: Would the DataSource need to be serializable for it to be storeded
as a session object?.
Not for in-proc sessions

Jun 7 '07 #2
On 7 Jun, 14:07, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Jun 7, 2:08 pm, mark4asp <mark4...@gmail.comwrote:
Q3: If I cache in the Session, apart from destroying the session
object (i.e the cached data) on leaving the page - are there any other
major considerations?

Session lives until the time specified for the session timeout
Thanks Alexey, the individual Session objects can be removed with
Session.Remove("TheName"). Furthermore I can write a class to run on
every page which overrides OnInit() to check that these session
objects have been killed when the user is no longer on that
appropriate page.

Jun 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
2
by: ven | last post by:
Hello i have a dynamic datatable in my page. I wanna to write data to textboxes and after click on button "ADD data" i want to refresh datagrid on page... Here is my code : ' Insert page code...
9
by: Joe Fallon | last post by:
If I add an instance of an object to the Cache what is returned when I request the item from the cache? Is it a clone of the object or is it a reference to the object? I want to know because I...
0
by: Chris Snyder | last post by:
I have a page that displays real-time data (road sensors updated every 5 minutes), but the query to display the data takes 15-20 seconds (big table in a DB w/o indexes, not my fault). This is...
3
by: Aryan | last post by:
Hi, I have problem related to Caching of data. I am reading large xml file and putting this xml in dataset, since this dataset will contain many datatable's inside. And each datatable might be big...
5
by: Stan SR | last post by:
Hi, Some newbie questions.. :-) First, what is the namespace to use for the Cache class ? When I use this bit of code I get an error if (Cache==null) Cache.Insert("myUserList",userlist);...
5
by: Joseph Geretz | last post by:
Of course, I can store a C# class instance to the Server Cache (this.Context.Cache). I've tried it. My question is, will this destroy the scalability of my application? My background is VB6....
0
by: dities13 | last post by:
Hello all and thank you for your time. We have a 3rd party application written for my office (vb.net 2.0 framework). However, we are getting reports of slow response time and do not believe it...
1
by: dities13 | last post by:
Hello all and thank you for your time. We have a 3rd party application written for my office (vb.net 2.0 framework). However, we are getting reports of slow response time and do not believe it...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.