dongquan6030 2015-08-31 21:24
浏览 25

用php创建异步数据库

I am building a system where every account has its own databases. Creating these databases when the user is actually creating the account results in a long wait before the page is refreshed. Logically, since php is still busy, so the page cannot finish.

Therefore my idea is to 'buffer' up a few, like 5 of these packages, all named $DBNAME$number, where number is 1 to 5. So I just rename the databases at account creation time, thereby minimizing the wait. I think this will work pretty well, but off course, I need to replenish my buffer.

That's where I figured I'd need a method to just replenish the database buffer in the background, which could even run while the accounts database is prepared, and the user is already logging in. The thing is, I haven't found a solution to this, while looking aroung a lot. I tried pthread, which runs exactly as if I would run the code inline. I even gave ajax a shot, hoping the .php file will run async, but it will not.

Does anyone have a recommendation on how to achieve this goal I have? PS: if xy problem, you may notify me ;)

  • 写回答

1条回答 默认 最新

  • dougourang1856 2015-08-31 21:37
    关注

    try using a single database which contains all the accounts or try semaphores instead. like

    wait function here //your entire work here and exit function here i hope this will work :)

    评论

报告相同问题?

悬赏问题

  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作