laravel 加cache锁

admin2年前Laravel738

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();

 


相关文章

百度浏览器中视频悬浮

  <video class="html5-video"                poster=...

验证手机号

public function phone($phone){    $pat = '/'        . '^13...

获取域名

/** * 获取域名 */public function domain(){    return request()->getSchemeAndHttpHost();}...

压缩图片

public static function size($id, $img) { try { list($width, $height, $img_type, $attr) = @getimages...

两个经纬度之间的距离

    public function haversineGreatCircleDistance($latitude1, $longitude1, $latitude2, $lon...

发送公众号信息

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