Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #14185
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: Asynchronous Function Call in PHP |
| Date | 2014-08-20 06:25 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <lt1t3a$3jj$1@dont-email.me> (permalink) |
| References | <0ca6166b-e6cd-445e-be59-bee46d8f0070@googlegroups.com> <lsvreh$ia9$2@dont-email.me> <bab60a92-5f22-48ec-8781-917b83364d47@googlegroups.com> |
On 8/20/2014 5:38 AM, Tuấn Dương Trần wrote: > Vào 22:45:21 UTC+7 Thứ ba, ngày 19 tháng tám năm 2014, Jerry Stuckle đã viết: >> On 8/19/2014 9:48 AM, Tuấn Dương Trần wrote: >> >>> Hi every body, >> >>> I'm building a website using Yii2, Redis, mysql. I need to write a function marking the songs, scores are stored in Redis and mysql. Scoring function using ajax to call the controler. I want this function to run in sequence as follows: The number is stored in Redis and returns immediately, then use a background thread to save the results into mysql. How i can do? >> >>> >> >>> Thanks. >> >>> >> You would have to start another script to update the MySQL database. >> >> This can be done with the exec() call, if it is allowed on your system >> >> (many shared hosts do not allow it). >> >> However, it shouldn't take long to update your database (i.e. typically >> >> milliseconds). Why do you think you need a background thread to do it? >> >> > > Thanks Jerry Stuckle, > > Function points that I mentioned above is a small part of the website that I am building. My websites like social networks, can automatically record user actions, keyword searches, favorite topics. I need a background process to calculate points based on that information, then write to the db. I'm looking to understand pthreads, but i don't know it can do? > I generally don't recommend the use of pthreads for the same reason that I generally don't recommend the use of exec() and the like. pthreads is a PECL class which requires special installation. You will find very few shared hosts who will install it for you; you will almost be assured you will have to run your own server. But once again - does it really take that long for what you want to do? Have you tried it? Or are you prematurely optimizing? I'm not sure what you need to "calculate" - but things like logging user information is still quite fast, and is done regularly by many CMS's, without the use of multi-threading. -- ================== Remove the "x" from my email address Jerry Stuckle jstucklex@attglobal.net ==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Asynchronous Function Call in PHP Tuấn Dương Trần <duongtt84@gmail.com> - 2014-08-19 06:48 -0700
Re: Asynchronous Function Call in PHP Jerry Stuckle <jstucklex@attglobal.net> - 2014-08-19 11:45 -0400
Re: Asynchronous Function Call in PHP Tuấn Dương Trần <duongtt84@gmail.com> - 2014-08-20 02:38 -0700
Re: Asynchronous Function Call in PHP Jerry Stuckle <jstucklex@attglobal.net> - 2014-08-20 06:25 -0400
Re: Asynchronous Function Call in PHP crankypuss <crankypuss@nomail.invalid> - 2014-08-21 03:18 -0600
Re: Asynchronous Function Call in PHP "Christoph M. Becker" <cmbecker69@arcor.de> - 2014-08-21 16:37 +0200
Re: Asynchronous Function Call in PHP crankypuss <crankypuss@nomail.invalid> - 2014-08-21 03:16 -0600
csiph-web