合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
查询构造器提供了少数函数协助你在 SELECT 语句中做到「悲观锁定」。 想要在 SELECT 语句中加上「Shard lock」,只要在查找语句中使用 `sharedLock` 函数: ~~~ DB::table('users')->where('votes', '>', 100)->sharedLock()->get(); ~~~ 要在 select 语法中使用「锁住更新(lock for update)」时,你可以使用 `lockForUpdate` 方法: ~~~ DB::table('users')->where('votes', '>', 100)->lockForUpdate()->get(); ~~~