Session cache and Cache

Source: Internet
Author: User

16.5 differences between session and Cache

In the past, there were many methods to cache data, including client cookies, Server sessions, and applications. Cookie is a set of data stored on the client, which is mainly used to save personal information such as the user name. Session stores the dialog information. The application is stored in the entire application.ProgramInformation within the range, which is equivalent to a global variable. Sessions are usually used most frequently. What is the difference between sessions and cache?

This section describes the differences between session cache and cache based on your experience.

(1) The biggest difference is that the cache provides a cache dependency to update data, and the session can only determine whether the cache data is valid Based on the defined cache time.

(2) even if the application is terminated, as long as the cache time defined in the cache. Add method does not expire, the cached data will still exist the next time the application is enabled. The session cache only exists in one session. After the session ends, the data becomes invalid.

(3) sessions are easy to lose, leading to data uncertainty, but the cache does not.

(4) because the session is loaded every time, it is not suitable for storing a large amount of information. Otherwise, the server performance will be reduced. The cache is mainly used to store large-capacity information, such as multiple tables in the database.

(5) the beta version of vs2005 provides parameters to save the cache on the hard disk. However, this function is canceled in the official version, and it is estimated that it will be implemented again in later versions. The session can only be stored in the memory, which affects its performance.

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.