Link to home
Start Free TrialLog in
Avatar of andieje
andieje

asked on

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
Avatar of asdavey
asdavey

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?
Avatar of andieje

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of asdavey
asdavey

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial