Application lock and unlock

Source: Internet
Author: User
Simply put, it can be understood that the application stores server-side data and can be changed by the task owner. To prevent multiple users from modifying the application at the same time, use the lock method to prevent others from modifying the application, wait until you finish the modification, and then use the unlock method to allow others to modify it.

Application. Lock/unlock usage:

Application. Lock ();
// OthersCode
Application [ " Value " ] = 1 ;
// Other code
Application. Unlock ();
When application. Lock is executed on any web page of the website, all operations related to the application on the whole site will be locked and delayed. (Including application assignment and application reading );
 
Eg.

Page:

Application. Lock ();
Application [ " Value " ] = 1 ;
System. Threading. thread. Sleep ( 10000 );
Application. Unlock ();

Page B:

Object Value = applcation [ " Value " ];

We first execute page A, and then execute page B. Because the application is locked on page A, you must wait until the execution on page a is complete before obtaining the value in application on page B.

 
 
 
The session stores client data and can only be changed (private) by itself ).
 
 

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.