xiaogang 4 år sedan
förälder
incheckning
119dc5fa7d
4 ändrade filer med 80 tillägg och 6 borttagningar
  1. 5 4
      app/Http/Controllers/Api/HomeController.php
  2. 1 0
      composer.json
  3. 73 1
      composer.lock
  4. 1 1
      config/database.php

+ 5 - 4
app/Http/Controllers/Api/HomeController.php

xqd xqd
@@ -14,6 +14,7 @@ use App\Services\RedisService;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\Redis;
 use PHPUnit\Util\Exception;
 
 class HomeController extends Controller
@@ -185,10 +186,10 @@ class HomeController extends Controller
 
             if ($lock->get()) {
                 if(!$user){
-                    dd(Cache::get(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url)));
-                    if(!Cache::has(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url))){
-                        Cache::put(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url),$request->url,86400*365);
-                        dd(Cache::get(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url)));
+                    //dd(Redis::get(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url)));
+                    if(!Redis::get(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url))){
+                        Redis::set(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url),$request->url,86400*365);
+                        dd(Redis::get(ApiEnum::PHOTO_DESTROY_URL.$cache_eq_id.md5($request->url)));
                     }
                 }else{
                     if(!UserPhotoDestroy::query()->where(['user_id'=>$user->id,'url'=>$request->url])->first()){

+ 1 - 0
composer.json

xqd
@@ -20,6 +20,7 @@
         "liyu/dingo-serializer-switch": "^0.3.2",
         "mews/captcha": "^3.2",
         "overtrue/easy-sms": "^1.3",
+        "predis/predis": "^1.1",
         "spatie/laravel-activitylog": "^3.17",
         "tencent/tls-sig-api-v2": "1.0",
         "tencentcloud/tencentcloud-sdk-php": "^3.0",

+ 73 - 1
composer.lock

xqd xqd
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "350b5945d12a4e1e990c25eba116349c",
+    "content-hash": "2095a10eb1d820e810d28a6eab8f1141",
     "packages": [
         {
             "name": "aliyuncs/oss-sdk-php",
@@ -3432,6 +3432,78 @@
             ],
             "time": "2020-07-20T17:29:33+00:00"
         },
+        {
+            "name": "predis/predis",
+            "version": "v1.1.7",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/predis/predis.git",
+                "reference": "b240daa106d4e02f0c5b7079b41e31ddf66fddf8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/predis/predis/zipball/b240daa106d4e02f0c5b7079b41e31ddf66fddf8",
+                "reference": "b240daa106d4e02f0c5b7079b41e31ddf66fddf8",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.3.9"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "~4.8"
+            },
+            "suggest": {
+                "ext-curl": "Allows access to Webdis when paired with phpiredis",
+                "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Predis\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Daniele Alessandri",
+                    "email": "suppakilla@gmail.com",
+                    "homepage": "http://clorophilla.net",
+                    "role": "Creator & Maintainer"
+                },
+                {
+                    "name": "Till Krüss",
+                    "homepage": "https://till.im",
+                    "role": "Maintainer"
+                }
+            ],
+            "description": "Flexible and feature-complete Redis client for PHP and HHVM",
+            "homepage": "http://github.com/predis/predis",
+            "keywords": [
+                "nosql",
+                "predis",
+                "redis"
+            ],
+            "support": {
+                "issues": "https://github.com/predis/predis/issues",
+                "source": "https://github.com/predis/predis/tree/v1.1.7"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/sponsors/tillkruss",
+                    "type": "github"
+                }
+            ],
+            "time": "2021-04-04T19:34:46+00:00"
+        },
         {
             "name": "psr/cache",
             "version": "1.0.1",

+ 1 - 1
config/database.php

xqd
@@ -119,7 +119,7 @@ return [
 
     'redis' => [
 
-        'client' => env('REDIS_CLIENT', 'phpredis'),
+        'client' => env('REDIS_CLIENT', 'predis'),
 
         'options' => [
             'cluster' => env('REDIS_CLUSTER', 'redis'),