0

I have a webpage, which takes a while to load because it has to pull information from lots of local databases. For example, if a user searches for person 1 then it will query 20 databases. It can sometimes take 5 minutes to pull all the information needed and apply the business logic. The best solution is to design a data warehouse, which is a long term aim.

If I use data caching it reduces the page load time (of the big records) from five minutes to four seconds. Is it bad practice to store information in the cache for a long period of time i.e. 24 hours? The cache will be refreshed every 24 hours. Alternatively I could store the cached information in a database table.

Every example I find online caches information for seconds e.g. 20 seconds.

w0051977
  • 15,099
  • 32
  • 152
  • 329

2 Answers2

0

Pros:

  • Faster load times
  • Less bandwidth usage
  • Less stress on the server

Cons:

  • May require high technical expertise to configure it just right
  • Will not work for content that is constantly being updated

For many system administrators, especially those with the skills to implement a caching system, the pros greatly outweigh the cons. Caching can make your websites run more smoothly for visitors and lessen the burden on your dedicated server.

For more Check this link

Abdul
  • 2,002
  • 7
  • 31
  • 65
  • Do you think it is bad practice to cache for such a long period of time i.e. 24 hours? – w0051977 Jun 27 '16 at 09:38
  • It depends on your page. if content is constantly updated then it might be a bad practise to cache for such a long period. – Abdul Jun 27 '16 at 09:40
  • you can check about asp.net cache options http://stackoverflow.com/questions/18937855/pros-cons-of-different-asp-net-caching-options – Abdul Jun 27 '16 at 09:47
  • if the content update and cache refresh occurs once or with same frequency then caching is a good solution. OR we can say the cache Refresh frequency should be greater than content update. – Abdul Jun 27 '16 at 10:35
0

Cache is used for global resources, if in your application the data is per user then use Session which is like cache per user.

You can also cache results and connect it to database tables so if a table is being update so does the cache it is called Cache Dependency.

The main concern you need to have is what if the cached information in not up to date, in that case use Cache Dependency.

Don't worry about memory issues in your server, the server is already optimized and knows to clean cache in case of lack in memory.

I hope this helps you.

Offir
  • 3,252
  • 3
  • 41
  • 73