laravel 加cache锁

admin1年前Laravel536

use Illuminate\Support\Facades\Redis;


use Illuminate\Support\Facades\Cache;
$lock = Cache::lock('lock_' . $this->user_id . '_' . $gid, 3);
$result = $lock->get(); if (!$result) { return $this->error('请不要重复提交');
}
Cache::lock('lock_' . $this->user_id . '_' . $gid)->forceRelease();

 


相关文章

阿里云发送短信

public function sms(){    $moile = request()->input('mobile');    if...

获取微信的Token

 public function Token()    {        $this->path = __DIR__ . &...

excel 导出

header("Content-Type: application/vnd.ms-excel; name='excel'"); header("Content-Disposition:atta...

关注公众号并登录

/* * 服务端生成带唯一标识二维码并将唯一标识返回给前端 */ public function wx_code() { $scene_str = $this->get_...

查找下级所有数据

public function bottom($mid = 3){    $members = DB::select('select id,parent_id,`level...

腾讯云发送短信

<?phpnamespace App\Http\Controllers;use Illuminate\Http\Request;use Illuminate\Support\Facades\DB...