I taking url from user and getting text of that url using
$data=file_get_content($url)
I am extracting title, image url from this $data. And storing into table urlrecord
and show it in div D1
on front end.
after that I perform processing on $data
which takes little time which gives me result $x
and $y
. (x and y i am not going to show in D1
)
x and y
also I have to store in urlrecord
table.
If I perform processing on $data
to get x and y
before then showing url content in front end ie D1
will be delayed.
So what I want is:
After storing URL content into table, I perform $data processing. And storing the $x and $y into same table.
bottomline is I dont want to reflect $data processing to get x,y to affect in show url content on front end.
Can some one think optimal scenario here?
I think you can create a cronjob to do the $data processing.
For example, there's a flag column in table urlrecord, default to 1, and the cronjob will scan the table every 5 mins, "select * from urlrecord where flag=1", calculate x and y, and update the flag to 2.