Some Understanding about TP3.2.3 delayed update and questions about where conflicts

Source: Internet
Author: User
Provides various official and user-released code examples. For code reference, you are welcome to learn more about TP3.2.3's understanding of delayed updates and questions about where conflicts. 1. Delayed update is not automatically updated after the specified delay time. 2. The where condition conflict of the coherent operation.
1. Starting from version 3.2.3, The setInc and setDec methods support delayed update. The usage is as follows: $ Article = M ("Article"); // instantiate the Article object
$ Article-> where ('Id = 5')-> setInc ('view',); // Add 1 to the number of articles read, and wait 60 seconds for updates (write)
This does not mean that the view field is updated 60 seconds after setInc is executed.That is, add 1 to the article reading. If this operation does not update the same view for the same model instance, the fields with the same condition (id = 5 ), if this article reads 1, it will not be executed, but it will be stored in the cache. If the same operation is executed again within 60 seconds, it will only be accumulated into the memory, only when the same operation is performed again 60 seconds later (the same field is updated for the same model instance and the same where condition) Will the previously accumulated value in the memory be updated to the database at a time.
2. The above uses a coherent operation where. If you want to query records after this operation, for example $Article->select();Here is just an example, not to query the number of readings of all articles.
The SQL statement changes SELECT * FROM tablename WHERE (id=5)This is obviously not the expected result.
The where condition in setInc will not be overwritten only when the where condition is added to the query. $Article->where('id=3')->select(); SELECT * FROM tablename WHERE (id=3)This is the expected result.

------------------------------------------------------------

Please advise if any of the above errors exist. Never give me some ugly words.

AD: truly free, domain name + VM + enterprise mailbox = 0 RMB

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.