Php synchronization solution introduction: This is a detailed page of the php synchronization solution. it introduces the knowledge, skills, experience and some php source code related to the PHP and php synchronization solutions.
Class = 'pingjiaf' frameborder = '0' src = 'http: // biancheng.dnbc?info/pingjia.php? Id = 356624 'Scrolling = 'no'> It is very troublesome to execute php synchronization. according to the mysql documentation, this can be done.
========================================================== ======================================
GET_LOCK (str, timeout)
Try to get a lock by using the given name of the string str. the timeout value is timeout seconds. If the lock is obtained successfully, 1 is returned. if the operation times out, 0 is returned (for example, because the name of another client has been blocked in advance ), if an error occurs, NULL is returned (for example, the thread mysqladmin kill is disconnected ). Assume that you have a lock obtained by using GET_LOCK (). when you execute RELEASE_LOCK () or your connection is disconnected (normal or abnormal), the lock is released.
This function can be used to execute application locks or simulate record locks. The name is locked within the server range. If a name has been blocked by a client, GET_LOCK () will block any requests from another client requesting to block the same name. This allows the client that has reached an agreement on a blocking name to use this name for cooperation to execute the recommended lock. However, you need to know that it also allows a client block name that is not in a combination of clients, whether in service or intentionally, to prevent any client in cooperation from blocking this name. One way to reduce this is to use database-specific or application-specific blocking names. For example, use the blocking name in the form of db_name.str or app_name.str.
========================================================== ======================================
If a file is not intended to be concurrently accessed by the user, it can only be accessed in sequence,
If the file a. php is not expected to be accessed by two requests at the same time, you can:
$ Db = getdb (); // Obtain the database connection.
$ Db-> query ('Do get_locak ');
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/356624.html pageNo: 2.