custom paging a datagrid and caching

Hi

I use the term custom paging to refer to the process of retrieving database records one page at a time rather than all in one go.

I have seen caching implemented with datagrids that use default paging (get all the records in one go). Is there any point/benefit from implementing caching with custom paging? How would you implement caching with custom paging?

Thanks very much

andrea
andiejeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

asdaveyCommented:
It depends.

The project that I'm working on at the moment can be connected to one of four different database technologies. Each have their pro's and con's but none have a consistent way to implement paging on the server side (ie the server only retrieves the rows needed for that page).

So we've had to implement our paging on the client side (by client side I mean the webserver as opposed to the database server). In a lot of respects this is dumb since we are forcing our web server to retrieve heaps of records into memory (which almost defeats the purpose of paging in the first place) and then determine which 20 records should be displayed. But we need the paging for of a UI reason (limited space).

Since it is likely that when the user see's a paged result set that they will navigate to at least one other page, we've implemented a client side cache. This saves us from making additional trips to the database to get the results of the other pages (since they were retrieved in the initial call).

The caveat of caching is its not the real data. If the data in the database changes, the user won't know about it for as long as they are using their cache. So we have a timeout on our cache. If its not hit within say 30 seconds, then another trip to the database is performed etc. The time to invalidate your cache depends heavily on the likelihood of data underneath changing and how important it is to display that data to the user.

Now to the second part of your question, how to implement the caching.

In ASP.Net 2 it is very easy, if you can use one of the datasource controls since they have caching built in. Which version of ASP.Net are you using?
0
andiejeAuthor Commented:
Hi

I am using asp.net 1.1 for this application (hence the datagrid)

I do my paging using a stored procedure that only returns the relevant page of records at a time. I was wondering if there was any way to incorporate caching too or if that was overkill/pointless.

Thanks
0
asdaveyCommented:
I would argue that caching would probably not worth the effort but a lot does depend on how expensive your query is.

Instead of caching the results from the database server, you could consider looking at caching the output from the webserver. ASP.Net 1/1.1 does support caching a page (or parts thereof) so that instead of execute code on the server, the cached page (or part of page) is returned instead. I know that you can set the cache to invalidate after a period of time, and that the cache can be made dependant on what form/querystring variables are present.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.