Ask questions about using static variables on the Asp.net site

Source: Internet
Author: User

MyProgramA function in requires a large amount of structured data, which is generated based on the combination of information in the database and configuration file. The data in the database is very stable and rarely changes; the configuration file is occasionally modified. In other words, the generation of this batch of data is very time-consuming, but it basically does not need to be changed once it is generated (unless I modify the configuration file, I will restart the site in that case ). Therefore, I use a static variable to represent this data. Its initialization process is encapsulated in a static constructor of the reader class, and some static methods are used to access this static variable.

My problem is:
1. Is it appropriate to use static variables to handle problems like me?
2. Using this method, does the data initialization process only need to be repeated as long as the site is not restarted? (I heard that when IIS occupies too much memory, some static variables will be recycled. I don't know which person can clearly explain that as long as the collection frequency is not too high, to meet my requirements .)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.