laravel 加cache锁

admin2年前Laravel698

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...

编辑用户信息

*/public function useredit(){    $avatar = request()->input('avatar');   &...

批量处理数据

   public function index44()    {        $domain = request(...

发送公众号信息

* 发送消息 */public function tosend($openid, $title, $content, $time, $aid){    $tokens = $thi...

上传图片

public function image(){    $obFile = request()->file('image');    if...

PHP 严格类型

只需在 PHP 代码文件的开头加上declare(strict_types = 1);这一行魔法代码,就能开启严格类型检查之旅。...