Last post Jul 24, 2015 09:21 AM by XIII
Jul 24, 2015 05:53 AM|devi.zerosoft|LINK
we have set the cache limit as 15 minutes.
Also as per our functionality, we have fetched two products randomly per member from the database and stored into the cache.
Then we have showed the product from the cache. So randomization of another two products will take every 15 minutes to affect.
If we refresh the page, we want to show another two products. If we reduce the cache limit, page load taking more time. Please advise on this.
Jul 24, 2015 06:41 AM|XIII|LINK
what exactly is the problem?
If we refresh the page, we want to show another two products
When still in the time window of 15 minutes and in cache?
Jul 24, 2015 07:01 AM|devi.zerosoft|LINK
After 15 minutes only another two products fetched from the database. But I need to change the product each refresh. so If we use the cache, after 15 minutes only product are changing in the page.
Please let me know still you are not clear.
Jul 24, 2015 07:20 AM|XIII|LINK
But I need to change the product each refresh.
If you need to refresh it on every page request then why do you put it in the Cache in the first place?
I suggest you take all products in cache when starting up your application and on every page request randomly take 2 products and show that. When it comes from Cache it doesn't need to go to the database and make expensive resource calls.
Jul 24, 2015 07:37 AM|devi.zerosoft|LINK
Query returns the below result.
If we store all the products cache means, then please explain how we can show two products per user, and another refresh another two products.
Shall we need to handle this in coding side. If possible please suggest me with the sample code.
Thanks for your help!
Jul 24, 2015 09:21 AM|XIII|LINK
and another refresh another two products.
If you want to show each time different 2 products then don't put them like this in Cache. At the moment you're saying to ASP.NET to get things out of Cache for the next x minutes. After that put new stuff in the Cache.
Either don't make use of Cache at all or only load, as I suggested before, the productnumbers in Cache and randomly pick from that list on each page request.