开发者

cache .ajax results and use them when back to page(back to results)

I have an asp.net page where i do some search on the database to fill employees table

开发者_如何学C

My table structure

Id    Full Name           Position   Degree                             

1     Carl Iken(href)     Manager    Doctorate

......

To do that I use .ajax and call a webservice

To view the details of an employee, I click the href full name. The problem is that when I click back to results, the table reloads again, that means call to database again and the user waiting. How can I avoid that, caching in jquery? A trick? Webservice caching?


You can cache that at a number of different levels. If your page isn't reloading you can use the jquery data apis or in your web service you can cache it, using the wcf caching support. If you're using html5 you could look at session storage, the list of options is huge, it really depends on your needs. If you're a low traffic site you may not need to cache it, a lookup like you've described shouldn't have a huge overhead, if it's being slow you may need to check if you're missing indexes on the backing database.

If you have a high traffic site and your database is very large then perhaps you should cache at every level possible. It's hard to answer this in a concrete fashion without more information on your setup/usage numbers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜