Kaynağa Gözat

Cache -> RedisCache

visuddhinanda 1 ay önce
ebeveyn
işleme
8f38e36c3a
40 değiştirilmiş dosya ile 144 ekleme ve 158 silme
  1. 2 2
      api-v13/app/Console/Commands/CacheDictPreference.php
  2. 3 3
      api-v13/app/Console/Commands/CacheWbwPreference.php
  3. 4 4
      api-v13/app/Console/Commands/ClearAppCache.php
  4. 2 2
      api-v13/app/Console/Commands/ClearEmbeddingsCache.php
  5. 2 2
      api-v13/app/Console/Commands/ExportChapterIndex.php
  6. 2 2
      api-v13/app/Console/Commands/ExportOffline.php
  7. 4 4
      api-v13/app/Console/Commands/ExportZip.php
  8. 4 4
      api-v13/app/Console/Commands/ExportZip2.php
  9. 5 5
      api-v13/app/Console/Commands/ExtractPaliTerm.php
  10. 5 5
      api-v13/app/Console/Commands/IndexTerm.php
  11. 2 2
      api-v13/app/Console/Commands/IndexTipitaka.php
  12. 6 6
      api-v13/app/Console/Commands/MqAiTranslate.php
  13. 3 3
      api-v13/app/Console/Commands/RemoveTermCache.php
  14. 2 2
      api-v13/app/Console/Commands/StatisticsNissayaCover.php
  15. 7 21
      api-v13/app/Console/Commands/TestRedis.php
  16. 5 5
      api-v13/app/Console/Commands/UpgradeAITerm.php
  17. 5 5
      api-v13/app/Console/Commands/UpgradeAITranslation.php
  18. 5 5
      api-v13/app/Console/Commands/UpgradeChapterDynamicWeekly.php
  19. 2 2
      api-v13/app/Console/Commands/UpgradeDict.php
  20. 3 3
      api-v13/app/Console/Commands/UpgradeDictDefaultMeaning.php
  21. 5 5
      api-v13/app/Console/Commands/UpgradeProgress.php
  22. 5 5
      api-v13/app/Console/Commands/UpgradeProgressChapter.php
  23. 5 5
      api-v13/app/Console/Commands/UpgradeProgressPara.php
  24. 5 5
      api-v13/app/Console/Commands/UpgradeSystemCommentary.php
  25. 5 5
      api-v13/app/Http/Api/TaskApi.php
  26. 2 2
      api-v13/app/Http/Api/TemplateRender.php
  27. 2 2
      api-v13/app/Http/Controllers/BookTitleController.php
  28. 3 3
      api-v13/app/Http/Controllers/CorpusController.php
  29. 6 6
      api-v13/app/Http/Controllers/DhammaTermController.php
  30. 2 2
      api-v13/app/Http/Controllers/DictMeaningController.php
  31. 2 2
      api-v13/app/Http/Controllers/EmailCertificationController.php
  32. 3 3
      api-v13/app/Http/Controllers/HealthCheckController.php
  33. 2 2
      api-v13/app/Http/Controllers/NissayaCoverController.php
  34. 2 2
      api-v13/app/Http/Controllers/PaliTextController.php
  35. 2 2
      api-v13/app/Http/Controllers/ProgressChapterController.php
  36. 3 3
      api-v13/app/Http/Controllers/ProgressImgController.php
  37. 6 6
      api-v13/app/Http/Controllers/RelationController.php
  38. 6 6
      api-v13/app/Http/Controllers/SentenceController.php
  39. 2 2
      api-v13/app/Http/Controllers/SentenceInfoController.php
  40. 3 3
      api-v13/app/Http/Controllers/SysModelController.php

+ 2 - 2
api-v13/app/Console/Commands/CacheDictPreference.php

@@ -2,10 +2,10 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\UserDict;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 
 class CacheDictPreference extends Command
@@ -61,7 +61,7 @@ class CacheDictPreference extends Command
             $meaning = trim($meaning, ' $');
             if (! empty($meaning)) {
                 $m = explode('$', $meaning);
-                Cache::put("{$prefix}/{$word->word}/{$word->language}", $m[0]);
+                RedisCache::put("{$prefix}/{$word->word}/{$word->language}", $m[0]);
             }
             $bar->advance();
             $count++;

+ 3 - 3
api-v13/app/Console/Commands/CacheWbwPreference.php

@@ -2,10 +2,10 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\WbwAnalysis;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 
 class CacheWbwPreference extends Command
@@ -74,7 +74,7 @@ class CacheWbwPreference extends Command
                     ->where('editor_id', $value->editor_id)
                     ->orderBy('updated_at', 'desc')
                     ->value('data');
-                Cache::put("{$prefix}/{$value->wbw_word}/{$value->type}/{$value->editor_id}", $data);
+                RedisCache::put("{$prefix}/{$value->wbw_word}/{$value->type}/{$value->editor_id}", $data);
                 $bar->advance();
                 $count++;
                 if ($count % 1000 === 0) {
@@ -109,7 +109,7 @@ class CacheWbwPreference extends Command
                     ->orderBy('count', 'desc')
                     ->first();
 
-                Cache::put("{$prefix}/{$value->wbw_word}/{$value->type}/0", $data->data);
+                RedisCache::put("{$prefix}/{$value->wbw_word}/{$value->type}/0", $data->data);
                 $bar->advance();
             }
             $bar->finish();

+ 4 - 4
api-v13/app/Console/Commands/ClearAppCache.php

@@ -2,8 +2,8 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 
 class ClearAppCache extends Command
 {
@@ -40,7 +40,7 @@ class ClearAppCache extends Command
         if (! $name && ! $this->option('all')) {
             $this->line('可清理的缓存项:');
             foreach (self::CACHES as $key => $item) {
-                $cached = collect($item['keys'])->filter(fn ($k) => Cache::has($k))->count();
+                $cached = collect($item['keys'])->filter(fn ($k) => RedisCache::has($k))->count();
                 $state = $cached > 0 ? "已缓存 {$cached}/".count($item['keys']) : '未缓存';
                 $this->line(sprintf('  %-14s %-34s [%s]', $key, $item['desc'], $state));
             }
@@ -62,8 +62,8 @@ class ClearAppCache extends Command
         foreach ($targets as $key => $item) {
             foreach ($item['keys'] as $cacheKey) {
                 // forget 对不存在的 key 也返回 true,所以先问一次才能如实报告清了几条
-                $existed = Cache::has($cacheKey);
-                Cache::forget($cacheKey);
+                $existed = RedisCache::has($cacheKey);
+                RedisCache::forget($cacheKey);
                 if ($existed) {
                     $cleared++;
                     $this->info("已清理 {$key}:{$cacheKey}");

+ 2 - 2
api-v13/app/Console/Commands/ClearEmbeddingsCache.php

@@ -36,8 +36,8 @@ class ClearEmbeddingsCache extends Command
                 $this->warn("缓存不存在: \"{$text}\"");
             }
         } else {
-            $count = $service->clearAllEmbeddingCache();
-            $this->info("已清理所有 embedding 缓存,共 {$count} 条");
+            $service->clearAllEmbeddingCache();
+            $this->info('已让所有 embedding 缓存失效,旧缓存 7 天内自然过期');
         }
 
         return 0;

+ 2 - 2
api-v13/app/Console/Commands/ExportChapterIndex.php

@@ -2,11 +2,11 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\Channel;
 use App\Models\ProgressChapter;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class ExportChapterIndex extends Command
@@ -65,7 +65,7 @@ class ExportChapterIndex extends Command
 
         $publicChannels = Channel::where('status', 30)->select('uid')->get();
         $rows = ProgressChapter::whereIn('channel_id', $publicChannels)->count();
-        Cache::put('/export/chapter/count', $rows, 3600 * 10);
+        RedisCache::put('/export/chapter/count', $rows, 3600 * 10);
         $bar = $this->output->createProgressBar($rows);
         foreach (
             ProgressChapter::whereIn('channel_id', $publicChannels)

+ 2 - 2
api-v13/app/Console/Commands/ExportOffline.php

@@ -2,9 +2,9 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class ExportOffline extends Command
@@ -55,7 +55,7 @@ class ExportOffline extends Command
         }
 
         // 清空redis
-        Cache::put('/offline/index', []);
+        RedisCache::put('/offline/index', []);
 
         // 删除全部的旧文件
         foreach (scandir($exportDir) as $key => $file) {

+ 4 - 4
api-v13/app/Console/Commands/ExportZip.php

@@ -2,9 +2,9 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\App;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Storage;
 use Symfony\Component\Process\Process;
@@ -170,7 +170,7 @@ class ExportZip extends Command
             'link' => $link,
             'hostname' => 'Amazon cloud storage(Hongkong)',
         ];
-        $info = Cache::get('/offline/index');
+        $info = RedisCache::get('/offline/index');
         if (! is_array($info)) {
             $info = [];
         }
@@ -180,11 +180,11 @@ class ExportZip extends Command
             'filename' => $zipFile,
             'url' => $url,
             'create_at' => date('Y-m-d H:i:s'),
-            'chapter' => Cache::get('/export/chapter/count'),
+            'chapter' => RedisCache::get('/export/chapter/count'),
             'filesize' => filesize($zipFullFileName),
             'min_app_ver' => '1.3',
         ];
-        Cache::put('/offline/index', $info);
+        RedisCache::put('/offline/index', $info);
         sleep(5);
         try {
             unlink($exportFullFileName);

+ 4 - 4
api-v13/app/Console/Commands/ExportZip2.php

@@ -2,9 +2,9 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use Illuminate\Console\Command;
 use Illuminate\Support\Facades\App;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Storage;
 use Symfony\Component\Process\Process;
@@ -142,7 +142,7 @@ class ExportZip2 extends Command
         |--------------------------------------------------------------------------
         */
 
-        $info = Cache::get('/offline/index', []);
+        $info = RedisCache::get('/offline/index', []);
         if (! is_array($info)) {
             $info = [];
         }
@@ -158,12 +158,12 @@ class ExportZip2 extends Command
             'filename' => $zipFile,
             'url' => $url,
             'create_at' => now()->toDateTimeString(),
-            'chapter' => Cache::get('/export/chapter/count'),
+            'chapter' => RedisCache::get('/export/chapter/count'),
             'filesize' => filesize($zipFullFileName),
             'min_app_ver' => '1.3',
         ];
 
-        Cache::put('/offline/index', $info);
+        RedisCache::put('/offline/index', $info);
 
         /*
         |--------------------------------------------------------------------------

+ 5 - 5
api-v13/app/Console/Commands/ExtractPaliTerm.php

@@ -2,6 +2,7 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Helpers\LlmResponseParser;
 use App\Http\Api\ChannelApi;
 use App\Http\Resources\AiModelResource;
@@ -11,7 +12,6 @@ use App\Services\OpenAIService;
 use App\Services\SentenceService;
 use App\Services\TermService;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class ExtractPaliTerm extends Command
@@ -113,7 +113,7 @@ class ExtractPaliTerm extends Command
         }
 
         if ($this->option('fresh')) {
-            Cache::forget(self::CURSOR_KEY);
+            RedisCache::forget(self::CURSOR_KEY);
             $this->info('cleared checkpoint');
         }
 
@@ -131,7 +131,7 @@ class ExtractPaliTerm extends Command
             return 1;
         }
 
-        $cursor = Cache::get(self::CURSOR_KEY, []);
+        $cursor = RedisCache::get(self::CURSOR_KEY, []);
 
         // ---------- 模式二:仅 book —— 同一 book 从断点续,跑完即止,不跳到下一 book ----------
         if ($this->option('book')) {
@@ -156,7 +156,7 @@ class ExtractPaliTerm extends Command
             $this->runBook($book, $glossaryJson, $book === $startBook ? $cursor : []);
         }
         // 全部完成,清空断点
-        Cache::forget(self::CURSOR_KEY);
+        RedisCache::forget(self::CURSOR_KEY);
         $this->info('all books completed');
 
         return 0;
@@ -221,7 +221,7 @@ class ExtractPaliTerm extends Command
             $this->processChapter($book, $start, $end, $glossaryJson);
 
             // 该 chapter 完成后写入断点(中途中断时不会误标记未完成的 chapter)
-            Cache::put(self::CURSOR_KEY, ['book' => $book, 'paragraph' => $start], now()->addHours(48));
+            RedisCache::put(self::CURSOR_KEY, ['book' => $book, 'paragraph' => $start], now()->addHours(48));
         }
     }
 

+ 5 - 5
api-v13/app/Console/Commands/IndexTerm.php

@@ -2,11 +2,11 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\DhammaTerm;
 use App\Services\OpenSearchService;
 use App\Services\TermIndexService;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class IndexTerm extends Command
@@ -40,7 +40,7 @@ class IndexTerm extends Command
         }
 
         if ($this->option('fresh')) {
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
             $this->info('Cleared cached cursor.');
         }
 
@@ -61,7 +61,7 @@ class IndexTerm extends Command
             }
 
             // 从缓存恢复断点:跳过上次已处理的记录
-            $lastId = Cache::get(self::CACHE_KEY);
+            $lastId = RedisCache::get(self::CACHE_KEY);
             if ($lastId && ! $word) {
                 $terms = $terms->where('id', '>', $lastId);
                 $this->info("Resuming after id={$lastId}");
@@ -79,7 +79,7 @@ class IndexTerm extends Command
                     $this->info("[{$percent}%]-{$curr}/{$total}  {$term->word}");
 
                     // 每 10 条保存一次断点
-                    Cache::put(self::CACHE_KEY, $term->id, now()->addHours(48));
+                    RedisCache::put(self::CACHE_KEY, $term->id, now()->addHours(48));
                 }
 
                 if ($this->isTest) {
@@ -91,7 +91,7 @@ class IndexTerm extends Command
             }
 
             // 全部完成,清除断点缓存
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
             $this->info("index-term finished. total: {$curr}");
 
             return 0;

+ 2 - 2
api-v13/app/Console/Commands/IndexTipitaka.php

@@ -2,6 +2,7 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Http\Api\ChannelApi;
 use App\Models\PaliText;
 use App\Models\ProgressChapter;
@@ -12,7 +13,6 @@ use App\Services\SearchPaliDataService;
 use App\Services\SummaryService;
 use App\Services\TagService;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class IndexTipitaka extends Command
@@ -395,7 +395,7 @@ class IndexTipitaka extends Command
             $document['title']['text']['pali'] = $title;
         }
         $document['content']['display'] = $param['content'];             // 展示
-        Cache::put($docId, $param['content']);
+        RedisCache::put($docId, $param['content']);
 
         if ($this->isTest) {
             $this->info($param['content']);

+ 6 - 6
api-v13/app/Console/Commands/MqAiTranslate.php

@@ -2,11 +2,11 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Http\Api\Mq;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
 use Illuminate\Http\Client\RequestException;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Log;
 
@@ -63,12 +63,12 @@ class MqAiTranslate extends Command
             // 获取model token
             $first = $messages[0];
             $taskId = $first->task->info->id;
-            Cache::put("/task/{$taskId}/message_id", $messageId);
+            RedisCache::put("/task/{$taskId}/message_id", $messageId);
             $pointerKey = "/message/{$messageId}/pointer";
             $pointer = 0;
-            if (Cache::has($pointerKey)) {
+            if (RedisCache::has($pointerKey)) {
                 // 回到上次中断的点
-                $pointer = Cache::get($pointerKey);
+                $pointer = RedisCache::get($pointerKey);
             }
 
             $modelToken = $first->model->token;
@@ -95,7 +95,7 @@ class MqAiTranslate extends Command
             }
 
             for ($i = $pointer; $i < count($messages); $i++) {
-                Cache::put($pointerKey, $i);
+                RedisCache::put($pointerKey, $i);
                 $message = $messages[$i];
                 $taskDiscussionContent = [];
                 $param = [
@@ -326,7 +326,7 @@ class MqAiTranslate extends Command
                     $this->setTaskStatus($message->task->info->id, 'done', $modelToken);
                 }
             }
-            Cache::forget($pointerKey);
+            RedisCache::forget($pointerKey);
             $this->info('ai translate task complete');
 
             return 0;

+ 3 - 3
api-v13/app/Console/Commands/RemoveTermCache.php

@@ -2,10 +2,10 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\Channel;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 
 class RemoveTermCache extends Command
 {
@@ -50,9 +50,9 @@ class RemoveTermCache extends Command
         } else {
             foreach ($channels as $key => $channel) {
                 $key = "/term/{$channel}/{$word}";
-                if (Cache::has($key)) {
+                if (RedisCache::has($key)) {
                     $this->info('has:'.$key);
-                    Cache::forget($key);
+                    RedisCache::forget($key);
                 }
             }
         }

+ 2 - 2
api-v13/app/Console/Commands/StatisticsNissayaCover.php

@@ -2,12 +2,12 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\Channel;
 use App\Models\PaliSentence;
 use App\Models\Sentence;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 
 class StatisticsNissayaCover extends Command
 {
@@ -353,7 +353,7 @@ class StatisticsNissayaCover extends Command
             $this->info($type.'='.$pali.'='.$final);
             $output[] = ['type' => $type, 'total' => $pali, 'final' => $final];
         }
-        Cache::put('/statistics/nissaya/cover', $output, 48 * 3600);
+        RedisCache::put('/statistics/nissaya/cover', $output, 48 * 3600);
 
         return 0;
     }

+ 7 - 21
api-v13/app/Console/Commands/TestRedis.php

@@ -2,8 +2,8 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Redis;
 
 class TestRedis extends Command
@@ -71,10 +71,10 @@ class TestRedis extends Command
         $this->info('testing cache put');
         $key = 'cache-key';
 
-        Cache::put($key, $value, 1000);
-        if (Cache::has($key)) {
+        RedisCache::put($key, $value, 1000);
+        if (RedisCache::has($key)) {
             $this->info("cache::put() exist key={$key}");
-            if (Cache::get($key) == $value) {
+            if (RedisCache::get($key) == $value) {
                 $this->info("cache::get() ok value={$value}");
             } else {
                 $this->error('cache::get() fail ');
@@ -83,27 +83,13 @@ class TestRedis extends Command
             $this->error('no key cache-key');
         }
 
-        $key = 'cache-key-2';
-        $this->info('testing cache() function');
-        $this->info("cache() key={$key} value={$value}");
-        cache(['cache-key-2' => $value]);
-        if (Cache::has($key)) {
-            if (Cache::get($key) == $value) {
-                $this->info("cache() get ok value={$value}");
-            } else {
-                $this->error('cache::get() fail ');
-            }
-        } else {
-            $this->error('no key cache-key-2');
-        }
-
         $key = 'cache-key-3';
         $this->info('testing cache remember()');
-        $value = Cache::remember($key, 600, function () {
+        $value = RedisCache::remember($key, 600, function () {
             return 'cache-value-3';
         });
-        if (Cache::has($key)) {
-            $this->info("{$key} exist value=".Cache::get($key));
+        if (RedisCache::has($key)) {
+            $this->info("{$key} exist value=".RedisCache::get($key));
         } else {
             $this->error('cache::remember() fail.');
         }

+ 5 - 5
api-v13/app/Console/Commands/UpgradeAITerm.php

@@ -2,13 +2,13 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\AiModelResource;
 use App\Services\AIAssistant\AITermService;
 use App\Services\AIModelService;
 use App\Services\AuthService;
 use App\Services\TermService;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 
 class UpgradeAITerm extends Command
 {
@@ -82,7 +82,7 @@ class UpgradeAITerm extends Command
         $this->aiTermService->setThinking($this->thinking);
 
         if ($this->option('fresh')) {
-            Cache::forget(self::CURSOR_KEY);
+            RedisCache::forget(self::CURSOR_KEY);
             $this->info('cleared checkpoint');
         }
 
@@ -114,7 +114,7 @@ class UpgradeAITerm extends Command
         $this->info("{$total} terms");
 
         $startIndex = 0;
-        $cursor = Cache::get(self::CURSOR_KEY, []);
+        $cursor = RedisCache::get(self::CURSOR_KEY, []);
         if (! empty($cursor)) {
             $pos = array_search($cursor['word'] ?? null, $terms, true);
             $startIndex = $pos !== false ? (int) $pos + 1 : (int) ($cursor['index'] ?? -1) + 1;
@@ -128,11 +128,11 @@ class UpgradeAITerm extends Command
             $this->info("[{$term}]content ".substr($result, 0, 30));
 
             // 该术语完成后写入断点(中途中断时不会误标记未完成的术语)
-            Cache::put(self::CURSOR_KEY, ['index' => $key, 'word' => $term], now()->addHours(48));
+            RedisCache::put(self::CURSOR_KEY, ['index' => $key, 'word' => $term], now()->addHours(48));
         }
 
         // 全部完成,清空断点
-        Cache::forget(self::CURSOR_KEY);
+        RedisCache::forget(self::CURSOR_KEY);
         $this->info('all terms completed');
     }
 }

+ 5 - 5
api-v13/app/Console/Commands/UpgradeAITranslation.php

@@ -2,6 +2,7 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Helpers\LlmResponseParser;
 use App\Http\Api\ChannelApi;
 use App\Http\Resources\AiModelResource;
@@ -14,7 +15,6 @@ use App\Services\AuthService;
 use App\Services\OpenAIService;
 use App\Services\SentenceService;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class UpgradeAITranslation extends Command
@@ -146,7 +146,7 @@ class UpgradeAITranslation extends Command
         $cacheKey = self::CACHE_KEY_PREFIX.':'.$type.':'.$channelId;
 
         if ($this->option('fresh')) {
-            // Cache::forget($cacheKey);
+            // RedisCache::forget($cacheKey);
             $this->info('Cleared cached cursor.');
         }
 
@@ -154,7 +154,7 @@ class UpgradeAITranslation extends Command
         $isFullRun = ! $this->option('book') && ! $this->option('para');
 
         // 从缓存恢复已完成的 (book, para) 集合,作为重入时的稳定游标
-        $done = []; // Cache::get($cacheKey, []);
+        $done = []; // RedisCache::get($cacheKey, []);
 
         $books = [];
         if ($this->option('book')) {
@@ -209,7 +209,7 @@ class UpgradeAITranslation extends Command
                 $this->info($this->argument('type')." {$book}-{$paragraph} ".count($data).' sentences time='.$time);
                 // 该处理单元全部写库完成后再标记游标,确保中途中断不会误跳过
                 $done[$cursor] = true;
-                // Cache::put($cacheKey, $done, now()->addHours(24));
+                // RedisCache::put($cacheKey, $done, now()->addHours(24));
             }
 
             $param = [
@@ -236,7 +236,7 @@ class UpgradeAITranslation extends Command
 
         // 完整遍历正常结束,清空断点缓存
         if ($isFullRun) {
-            // Cache::forget($cacheKey);
+            // RedisCache::forget($cacheKey);
         }
 
         return 0;

+ 5 - 5
api-v13/app/Console/Commands/UpgradeChapterDynamicWeekly.php

@@ -2,13 +2,13 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\PaliText;
 use App\Models\ProgressChapter;
 use App\Models\SentHistory;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
 use Illuminate\Support\Carbon;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class UpgradeChapterDynamicWeekly extends Command
@@ -89,13 +89,13 @@ class UpgradeChapterDynamicWeekly extends Command
                 $progress[] = $count;
             }
             $key = "/chapter_dynamic/{$chapter->book}/{$chapter->para}/global";
-            Cache::put($key, $progress, 3600 * 24 * 7);
+            RedisCache::put($key, $progress, 3600 * 24 * 7);
 
             $bar->advance();
 
             if ($this->option('test')) {
                 $this->info("key:{$key}");
-                if (Cache::has($key)) {
+                if (RedisCache::has($key)) {
                     $this->info('has key '.$key);
                 }
                 break; // 调试代码
@@ -146,12 +146,12 @@ class UpgradeChapterDynamicWeekly extends Command
                 $progress[] = $count;
             }
             $key = "/chapter_dynamic/{$chapter->book}/{$chapter->para}/ch_{$chapter->channel_id}";
-            Cache::put($key, $progress, 3600 * 24 * 7);
+            RedisCache::put($key, $progress, 3600 * 24 * 7);
             $bar->advance();
 
             if ($this->option('test')) {
                 $this->info("key:{$key}");
-                if (Cache::has($key)) {
+                if (RedisCache::has($key)) {
                     $this->info('has key '.$key);
                 }
                 break; // 调试代码

+ 2 - 2
api-v13/app/Console/Commands/UpgradeDict.php

@@ -2,11 +2,11 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\DictInfo;
 use App\Models\UserDict;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Str;
 
@@ -132,7 +132,7 @@ class UpgradeDict extends Command
                                                         if (isset($newPart[$part])) {
                                                             $newPart[$part][0]++;
                                                         } else {
-                                                            $partExists = Cache::remember('dict/part/'.$part, config('cache.expire', 1000), function () use ($part) {
+                                                            $partExists = RedisCache::remember('dict/part/'.$part, config('cache.expire', 1000), function () use ($part) {
                                                                 return UserDict::where('word', $part)->exists();
                                                             });
                                                             if (! $partExists) {

+ 3 - 3
api-v13/app/Console/Commands/UpgradeDictDefaultMeaning.php

@@ -11,10 +11,10 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\UserDict;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class UpgradeDictDefaultMeaning extends Command
@@ -117,7 +117,7 @@ class UpgradeDictDefaultMeaning extends Command
                     ->cursor() as $word
             ) {
                 if (! empty($word['note'])) {
-                    Cache::put("dict_first_mean/{$thisLang}/{$word['word']}", mb_substr($word['note'], 0, 50, 'UTF-8'));
+                    RedisCache::put("dict_first_mean/{$thisLang}/{$word['word']}", mb_substr($word['note'], 0, 50, 'UTF-8'));
                 }
                 $bar->advance();
             }
@@ -138,7 +138,7 @@ class UpgradeDictDefaultMeaning extends Command
                         if (! empty($_word) && $word['word'] === $_word) {
                             Log::info($cacheKey.':'.$cacheValue);
                         }
-                        Cache::put($cacheKey, $cacheValue);
+                        RedisCache::put($cacheKey, $cacheValue);
                     }
 
                     if ($count % 1000 === 0) {

+ 5 - 5
api-v13/app/Console/Commands/UpgradeProgress.php

@@ -2,10 +2,10 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use Illuminate\Console\Attributes\Description;
 use Illuminate\Console\Attributes\Signature;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 
 #[Signature('app:upgrade-progress {--fresh : Clear cached progress and start from scratch}')]
 #[Description('Run upgrade progress commands (reentrant via Cache)')]
@@ -17,11 +17,11 @@ class UpgradeProgress extends Command
     public function handle(): int
     {
         if ($this->option('fresh')) {
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
             $this->info('Cleared cached progress.');
         }
 
-        $completedSteps = Cache::get(self::CACHE_KEY, []);
+        $completedSteps = RedisCache::get(self::CACHE_KEY, []);
 
         $steps = [
             'para' => 'upgrade:progress.para',
@@ -45,10 +45,10 @@ class UpgradeProgress extends Command
             }
 
             $completedSteps[] = $key;
-            Cache::put(self::CACHE_KEY, $completedSteps, now()->addHours(48));
+            RedisCache::put(self::CACHE_KEY, $completedSteps, now()->addHours(48));
         }
 
-        Cache::forget(self::CACHE_KEY);
+        RedisCache::forget(self::CACHE_KEY);
         $this->info('All steps completed.');
 
         return 0;

+ 5 - 5
api-v13/app/Console/Commands/UpgradeProgressChapter.php

@@ -2,6 +2,7 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Http\Api\MdRender;
 use App\Models\Channel;
 use App\Models\PaliSentence;
@@ -15,7 +16,6 @@ use App\Tools\Markdown;
 use App\Tools\Tools;
 use Carbon\Carbon;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Validator;
 
 class UpgradeProgressChapter extends Command
@@ -36,7 +36,7 @@ class UpgradeProgressChapter extends Command
         }
 
         if ($this->option('fresh')) {
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
             $this->info('Cleared cached cursor.');
         }
 
@@ -61,7 +61,7 @@ class UpgradeProgressChapter extends Command
         $books = $this->buildBookList($book);
 
         // 从缓存恢复断点:跳过上次已完成的 book
-        $lastBookId = Cache::get(self::CACHE_KEY);
+        $lastBookId = RedisCache::get(self::CACHE_KEY);
         if ($lastBookId && ! $book) {
             $books = $books->filter(fn ($b) => $b->book_id > $lastBookId)->values();
             $this->info("Resuming after book={$lastBookId}");
@@ -112,11 +112,11 @@ class UpgradeProgressChapter extends Command
             }
 
             // 每完成一本书,保存断点
-            Cache::put(self::CACHE_KEY, $bookRow->book_id, now()->addHours(48));
+            RedisCache::put(self::CACHE_KEY, $bookRow->book_id, now()->addHours(48));
         }
 
         // 全部完成,清除断点缓存
-        Cache::forget(self::CACHE_KEY);
+        RedisCache::forget(self::CACHE_KEY);
 
         $time = time() - $startTime;
         $this->info("upgrade:progress.chapter finished in {$time}s tag count:{$tagCount}");

+ 5 - 5
api-v13/app/Console/Commands/UpgradeProgressPara.php

@@ -2,12 +2,12 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Models\PaliSentence;
 use App\Models\Progress;
 use App\Models\Sentence;
 use App\Tools\Tools;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 
 class UpgradeProgressPara extends Command
@@ -26,7 +26,7 @@ class UpgradeProgressPara extends Command
         }
 
         if ($this->option('fresh')) {
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
             $this->info('Cleared cached cursor.');
         }
 
@@ -45,7 +45,7 @@ class UpgradeProgressPara extends Command
         $sentences = $this->buildQuery($book, $para, $channelId);
 
         // 从缓存恢复断点:跳过上次已处理的记录
-        $cursor = Cache::get(self::CACHE_KEY);
+        $cursor = RedisCache::get(self::CACHE_KEY);
         if ($cursor && ! $this->option('book')) {
             $sentences = $this->applyResumeFilter($sentences, $cursor);
             $this->info("Resuming from book={$cursor['book']}, para={$cursor['para']}");
@@ -95,7 +95,7 @@ class UpgradeProgressPara extends Command
 
             // 每 500 条保存一次断点到缓存
             if ($curr % 500 === 0) {
-                Cache::put(self::CACHE_KEY, [
+                RedisCache::put(self::CACHE_KEY, [
                     'book' => $sentence->book_id,
                     'para' => $sentence->paragraph,
                 ], now()->addHours(48));
@@ -107,7 +107,7 @@ class UpgradeProgressPara extends Command
         }
 
         // 全部完成,清除断点缓存
-        Cache::forget(self::CACHE_KEY);
+        RedisCache::forget(self::CACHE_KEY);
 
         $time = time() - $startTime;
         $this->info("upgrade:progress.para finished in {$time}s");

+ 5 - 5
api-v13/app/Console/Commands/UpgradeSystemCommentary.php

@@ -2,6 +2,7 @@
 
 namespace App\Console\Commands;
 
+use App\Facades\RedisCache;
 use App\Helpers\LlmResponseParser;
 use App\Http\Api\ChannelApi;
 use App\Http\Resources\AiModelResource;
@@ -16,7 +17,6 @@ use App\Services\OpenAIService;
 use App\Services\SearchPaliDataService;
 use App\Services\SentenceService;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 
 class UpgradeSystemCommentary extends Command
@@ -124,7 +124,7 @@ class UpgradeSystemCommentary extends Command
         }
 
         if ($this->option('fresh')) {
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
             $this->info('Cleared cached cursor.');
         }
 
@@ -137,7 +137,7 @@ class UpgradeSystemCommentary extends Command
         $isFullRun = ! $this->option('book') && ! $this->option('para');
 
         // 从缓存恢复已完成的 (book_name, cs_para) 集合,作为重入时的稳定游标
-        $done = Cache::get(self::CACHE_KEY, []);
+        $done = RedisCache::get(self::CACHE_KEY, []);
 
         // 需要跳过的 book_name 规则,逗号分隔,以 * 结尾为前缀匹配,否则全等匹配
         $skipPatterns = [];
@@ -294,13 +294,13 @@ class UpgradeSystemCommentary extends Command
 
                 // 该处理单元全部写库完成后再标记游标,确保中途中断不会误跳过
                 $done[$cursor] = true;
-                Cache::put(self::CACHE_KEY, $done, now()->addHours(24));
+                RedisCache::put(self::CACHE_KEY, $done, now()->addHours(24));
             }
         }
 
         // 完整遍历正常结束,清空断点缓存
         if ($isFullRun) {
-            Cache::forget(self::CACHE_KEY);
+            RedisCache::forget(self::CACHE_KEY);
         }
 
         return 0;

+ 5 - 5
api-v13/app/Http/Api/TaskApi.php

@@ -2,9 +2,9 @@
 
 namespace App\Http\Api;
 
+use App\Facades\RedisCache;
 use App\Models\Task;
 use App\Models\TaskRelation;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Str;
 
 class TaskApi
@@ -85,8 +85,8 @@ class TaskApi
     public static function getRelationTasks($taskId, $relation = 'pre')
     {
         $key = TaskApi::taskRelationRedisKey($taskId, $relation);
-        // Log::debug('task redis key=' . $key . ' has=' . Cache::has($key));
-        $data = Cache::remember($key, 24 * 3600, function () use ($taskId, $relation) {
+        // Log::debug('task redis key=' . $key . ' has=' . RedisCache::has($key));
+        $data = RedisCache::remember($key, 24 * 3600, function () use ($taskId, $relation) {
             if ($relation === 'pre') {
                 $where = 'next_task_id';
                 $select = 'task_id';
@@ -131,9 +131,9 @@ class TaskApi
         }
         foreach ($relationsId as $taskId => $value) {
             $key = TaskApi::taskRelationRedisKey($taskId, 'pre');
-            Cache::forget($key);
+            RedisCache::forget($key);
             $key = TaskApi::taskRelationRedisKey($taskId, 'next');
-            Cache::forget($key);
+            RedisCache::forget($key);
         }
     }
 

+ 2 - 2
api-v13/app/Http/Api/TemplateRender.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Api;
 
+use App\Facades\RedisCache;
 use App\Http\Controllers\CorpusController;
 use App\Models\BookTitle as BookSeries;
 use App\Models\Channel;
@@ -11,7 +12,6 @@ use App\Models\PageNumber;
 use App\Models\PaliText;
 use App\Services\ArticleService;
 use App\Tools\Tools;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Str;
 
@@ -832,7 +832,7 @@ class TemplateRender
     {
         $paraId = $this->get_param($this->param, 'para', 1);
         $channelId = $this->channel_id[0];
-        $props = Cache::remember(
+        $props = RedisCache::remember(
             "/quote/{$channelId}/{$paraId}",
             config('mint.cache.expire'),
             function () use ($paraId, $channelId) {

+ 2 - 2
api-v13/app/Http/Controllers/BookTitleController.php

@@ -2,12 +2,12 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\BookTitleResource;
 use App\Models\BookTitle;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Collection;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 
 class BookTitleController extends Controller
@@ -28,7 +28,7 @@ class BookTitleController extends Controller
     public function index()
     {
         //
-        $data = Cache::remember(self::CACHE_KEY, self::CACHE_TTL, function () {
+        $data = RedisCache::remember(self::CACHE_KEY, self::CACHE_TTL, function () {
             $result = BookTitle::orderBy('sn')->get();
             $meta = $this->paliTextMeta($result);
             $relatedNames = $this->relatedNames($result);

+ 3 - 3
api-v13/app/Http/Controllers/CorpusController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Api\ChannelApi;
 use App\Http\Api\MdRender;
 use App\Http\Api\StudioApi;
@@ -22,7 +23,6 @@ use App\Services\PaliContentService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Arr;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Redis;
 use Illuminate\Support\Str;
@@ -768,7 +768,7 @@ class CorpusController extends Controller
 
                             break;
                         case 'nissaya':
-                            $newSent['html'] = Cache::remember(
+                            $newSent['html'] = RedisCache::remember(
                                 "/sent/{$channelId}/{$currSentId}/{$format}",
                                 config('mint.cache.expire'),
                                 function () use ($row, $mode, $format) {
@@ -1055,7 +1055,7 @@ class CorpusController extends Controller
         } else {
             $keyCanRead .= 'guest';
         }
-        $channelCanRead = Cache::remember(
+        $channelCanRead = RedisCache::remember(
             $keyCanRead,
             config('mint.cache.expire'),
             function () use ($userUuid) {

+ 6 - 6
api-v13/app/Http/Controllers/DhammaTermController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Api\ChannelApi;
 use App\Http\Api\ShareApi;
 use App\Http\Api\StudioApi;
@@ -14,7 +15,6 @@ use App\Services\AuthService;
 use App\Services\TermIndexService;
 use App\Tools\Tools;
 use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Str;
@@ -192,7 +192,7 @@ class DhammaTermController extends Controller
                 break;
             case 'hot-meaning':
                 $key = 'term/hot_meaning';
-                $value = Cache::remember($key, config('mint.cache.expire'), function () use ($request) {
+                $value = RedisCache::remember($key, config('mint.cache.expire'), function () use ($request) {
                     $hotMeaning = [];
                     $words = DhammaTerm::select('word')
                         ->where('language', $request->input('language'))
@@ -218,9 +218,9 @@ class DhammaTermController extends Controller
                             ];
                         }
                     }
-                    // FIXME: 外层 Cache::remember 已负责写缓存,这里重复写入且 TTL(3600)
+                    // FIXME: 外层 RedisCache::remember 已负责写缓存,这里重复写入且 TTL(3600)
                     // 与 config('mint.cache.expire') 不一致;应删除这一行。
-                    Cache::put($key, $hotMeaning, 3600);
+                    RedisCache::put($key, $hotMeaning, 3600);
 
                     return $hotMeaning;
                 });
@@ -404,10 +404,10 @@ class DhammaTermController extends Controller
             foreach ($channels as $channel) {
                 // FIXME: $channel 是 Eloquent 模型对象,插值后得到的是 JSON 而非 uid,
                 // 缓存键与写入时的键对不上,studio 级术语的缓存实际没被清掉;应用 $channel->uid。
-                Cache::forget("/term/{$channel}/{$term->word}");
+                RedisCache::forget("/term/{$channel}/{$term->word}");
             }
         } else {
-            Cache::forget("/term/{$term->channal}/{$term->word}");
+            RedisCache::forget("/term/{$term->channal}/{$term->word}");
         }
     }
 

+ 2 - 2
api-v13/app/Http/Controllers/DictMeaningController.php

@@ -2,10 +2,10 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Models\UserDict;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 
 class DictMeaningController extends Controller
 {
@@ -71,7 +71,7 @@ class DictMeaningController extends Controller
             foreach ($this->langOrder[$lang] as $key => $value) {
                 // 遍历每种语言。找到返回
                 $cacheKey = "dict_first_mean/{$value}/{$word}";
-                $meaning = Cache::get($cacheKey);
+                $meaning = RedisCache::get($cacheKey);
                 if (! empty($meaning)) {
                     $currMeaning = $meaning;
                     break;

+ 2 - 2
api-v13/app/Http/Controllers/EmailCertificationController.php

@@ -2,13 +2,13 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\InviteResource;
 use App\Mail\EmailCertif;
 use App\Models\Invite;
 use App\Models\UserInfo;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Mail;
 use Illuminate\Support\Str;
@@ -74,7 +74,7 @@ class EmailCertificationController extends Controller
     public function show(string $id)
     {
         //
-        $code = Cache::get('/email/certification/'.$id);
+        $code = RedisCache::get('/email/certification/'.$id);
         if (empty($code)) {
             return $this->error('Certification is avalide', 200, 200);
         }

+ 3 - 3
api-v13/app/Http/Controllers/HealthCheckController.php

@@ -2,11 +2,11 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Services\OpenSearchService;
 use App\Services\RabbitMQService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Log;
 
@@ -34,8 +34,8 @@ class HealthCheckController extends Controller
 
         // Cache
         try {
-            Cache::put('health_check', true, 5);
-            Cache::get('health_check');
+            RedisCache::put('health_check', true, 5);
+            RedisCache::get('health_check');
             $checks['cache'] = true;
         } catch (\Throwable $e) {
             $checks['cache'] = false;

+ 2 - 2
api-v13/app/Http/Controllers/NissayaCoverController.php

@@ -2,9 +2,9 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 
 class NissayaCoverController extends Controller
 {
@@ -16,7 +16,7 @@ class NissayaCoverController extends Controller
     public function index()
     {
         //
-        $cover = Cache::get('/statistics/nissaya/cover');
+        $cover = RedisCache::get('/statistics/nissaya/cover');
 
         return $this->ok($cover);
     }

+ 2 - 2
api-v13/app/Http/Controllers/PaliTextController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\PaliTextResource;
 use App\Models\BookTitle;
 use App\Models\PaliText;
@@ -10,7 +11,6 @@ use App\Models\TagMap;
 use App\Services\PaliTextService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 
 class PaliTextController extends Controller
@@ -310,7 +310,7 @@ class PaliTextController extends Controller
                 if (is_object($value)) {
                     // TODO $value->book 可能不存在
                     $progress_key = "/chapter_dynamic/{$value->book}/{$value->paragraph}/global";
-                    $chapters[$key]->progress_line = Cache::get($progress_key);
+                    $chapters[$key]->progress_line = RedisCache::get($progress_key);
                 }
             }
         }

+ 2 - 2
api-v13/app/Http/Controllers/ProgressChapterController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Api\StudioApi;
 use App\Models\Channel;
 use App\Models\Like;
@@ -13,7 +14,6 @@ use App\Models\View;
 use App\Services\AuthService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Str;
 
@@ -241,7 +241,7 @@ class ProgressChapterController extends Controller
                     $chapters[$key]->studio = StudioApi::getById($value->owner_uid);
                     $chapters[$key]->channel = ['uid' => $value->channel_id, 'name' => $value->name, 'type' => $value->type];
                     $progress_key = "/chapter_dynamic/{$value->book}/{$value->para}/ch_{$value->channel_id}";
-                    $chapters[$key]->progress_line = Cache::get($progress_key);
+                    $chapters[$key]->progress_line = RedisCache::get($progress_key);
                 }
 
                 $all_count = count($chapters);

+ 3 - 3
api-v13/app/Http/Controllers/ProgressImgController.php

@@ -2,9 +2,9 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 
 class ProgressImgController extends Controller
 {
@@ -39,10 +39,10 @@ class ProgressImgController extends Controller
         //
         return response()->stream(function () use ($id) {
             $key = str_replace('-', '/', $id);
-            $svg = Cache::remember('svg/'.$key, config('mint.cache.expire'), function () use ($key) {
+            $svg = RedisCache::remember('svg/'.$key, config('mint.cache.expire'), function () use ($key) {
                 $viewHeight = 60;
                 $svg = "<svg xmlns='http://www.w3.org/2000/svg'  fill='currentColor' viewBox='0 0 300 60'>";
-                $data = Cache::get($key);
+                $data = RedisCache::get($key);
                 if (is_array($data)) {
                     $point = [];
                     foreach ($data as $key => $value) {

+ 6 - 6
api-v13/app/Http/Controllers/RelationController.php

@@ -2,13 +2,13 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\RelationResource;
 use App\Models\Relation;
 use App\Services\AuthService;
 use Illuminate\Http\JsonResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
-use Illuminate\Support\Facades\Cache;
 use PhpOffice\PhpSpreadsheet\Spreadsheet;
 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
 
@@ -30,7 +30,7 @@ class RelationController extends Controller
     {
         if ($request->boolean('vocabulary')) {
             return $this->ok(
-                Cache::remember(
+                RedisCache::remember(
                     self::VOCABULARY_CACHE_KEY,
                     config('mint.cache.expire'),
                     fn () => $this->buildVocabularyPayload()
@@ -67,7 +67,7 @@ class RelationController extends Controller
         $relation->editor_id = $user['user_uid'];
         $relation->save();
 
-        Cache::forget(self::VOCABULARY_CACHE_KEY);
+        RedisCache::forget(self::VOCABULARY_CACHE_KEY);
 
         return $this->ok(new RelationResource($relation));
     }
@@ -101,7 +101,7 @@ class RelationController extends Controller
         $relation->editor_id = $user['user_uid'];
         $relation->save();
 
-        Cache::forget(self::VOCABULARY_CACHE_KEY);
+        RedisCache::forget(self::VOCABULARY_CACHE_KEY);
 
         return $this->ok(new RelationResource($relation));
     }
@@ -120,7 +120,7 @@ class RelationController extends Controller
 
         $deleted = $relation->delete();
 
-        Cache::forget(self::VOCABULARY_CACHE_KEY);
+        RedisCache::forget(self::VOCABULARY_CACHE_KEY);
 
         return $this->ok($deleted);
     }
@@ -204,7 +204,7 @@ class RelationController extends Controller
             $currLine++;
         }
 
-        Cache::forget(self::VOCABULARY_CACHE_KEY);
+        RedisCache::forget(self::VOCABULARY_CACHE_KEY);
 
         $success = $currLine - 2 - $countFail;
 

+ 6 - 6
api-v13/app/Http/Controllers/SentenceController.php

@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Api\ChannelApi;
 use App\Http\Api\Mq;
 use App\Http\Api\PaliTextApi;
@@ -16,7 +17,6 @@ use App\Services\SentenceService;
 use App\Tools\OpsLog;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Redis;
 use Illuminate\Support\Str;
 
@@ -496,7 +496,7 @@ class SentenceController extends Controller
         // 清除cache
         $channelId = $param[4];
         $currSentId = "{$param[0]}-{$param[1]}-{$param[2]}-{$param[3]}";
-        Cache::forget("/sent/{$channelId}/{$currSentId}");
+        RedisCache::forget("/sent/{$channelId}/{$currSentId}");
         // 保存历史记录
         if ($request->has('prEditor')) {
             $this->sentenceService->saveHistory(
@@ -564,8 +564,8 @@ class SentenceController extends Controller
             if (! empty($word->meaning->value)) {
                 $newData['data'] = $word->meaning->value;
                 WbwAnalysis::insert($newData);
-                Cache::put("{$prefix}/{$word->real->value}/3/{$editorId}", $word->meaning->value);
-                Cache::put("{$prefix}/{$word->real->value}/3/0", $word->meaning->value);
+                RedisCache::put("{$prefix}/{$word->real->value}/3/{$editorId}", $word->meaning->value);
+                RedisCache::put("{$prefix}/{$word->real->value}/3/0", $word->meaning->value);
             }
             if (isset($word->factors) && isset($word->factorMeaning)) {
                 $factors = explode('+', str_replace('-', '+', $word->factors->value));
@@ -577,8 +577,8 @@ class SentenceController extends Controller
                             $newData['data'] = $factorMeaning[$key];
                             $newData['type'] = 5;
                             WbwAnalysis::insert($newData);
-                            Cache::put("{$prefix}/{$factor}/5/{$editorId}", $factorMeaning[$key]);
-                            Cache::put("{$prefix}/{$factor}/5/0", $factorMeaning[$key]);
+                            RedisCache::put("{$prefix}/{$factor}/5/{$editorId}", $factorMeaning[$key]);
+                            RedisCache::put("{$prefix}/{$factor}/5/0", $factorMeaning[$key]);
                         }
                     }
                 }

+ 2 - 2
api-v13/app/Http/Controllers/SentenceInfoController.php

@@ -2,13 +2,13 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\SentResource;
 use App\Models\PaliSentence;
 use App\Models\PaliText;
 use App\Models\Sentence;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 
 class SentenceInfoController extends Controller
 {
@@ -114,7 +114,7 @@ class SentenceInfoController extends Controller
             foreach ($sentFinished as $sent) {
                 // code...
                 $key_sent_id = $sent->book_id.'-'.$sent->paragraph.'-'.$sent->word_start.'-'.$sent->word_end;
-                $para_strlen += Cache::remember(
+                $para_strlen += RedisCache::remember(
                     'pali-sent/strlen/'.$key_sent_id,
                     config('mint.cache.expire'),
                     function () use ($sent) {

+ 3 - 3
api-v13/app/Http/Controllers/SysModelController.php

@@ -2,12 +2,12 @@
 
 namespace App\Http\Controllers;
 
+use App\Facades\RedisCache;
 use App\Http\Resources\AiModelResource;
 use App\Models\AiModel;
 use App\Services\AuthService;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
-use Illuminate\Support\Facades\Cache;
 
 class SysModelController extends Controller
 {
@@ -25,7 +25,7 @@ class SysModelController extends Controller
         if (! $user) {
             return $this->error(__('auth.failed'), 401, 401);
         }
-        $modelsId = Cache::get($this->key.$request->input('view', 'wbw'));
+        $modelsId = RedisCache::get($this->key.$request->input('view', 'wbw'));
         if (! is_array($modelsId)) {
             $modelsId = [];
         }
@@ -52,7 +52,7 @@ class SysModelController extends Controller
         if (! $user) {
             return $this->error(__('auth.failed'), 401, 401);
         }
-        Cache::put(
+        RedisCache::put(
             $this->key.$request->input('view', 'wbw'),
             $request->input('models')
         );