Cache: Increases database cache value size
Upped from text to medium text. Aligns with modern Laravel default. Fixes #4453 where were reaching the limit of TEXT.
This commit is contained in:
parent
391478465a
commit
0628c28f66
2 changed files with 41 additions and 5 deletions
|
@ -7,6 +7,7 @@ use Exception;
|
||||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Cache;
|
use Illuminate\Support\Facades\Cache;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Illuminate\Validation\Rules\Password;
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
@ -27,13 +28,16 @@ class ApiDocsGenerator
|
||||||
{
|
{
|
||||||
$appVersion = trim(file_get_contents(base_path('version')));
|
$appVersion = trim(file_get_contents(base_path('version')));
|
||||||
$cacheKey = 'api-docs::' . $appVersion;
|
$cacheKey = 'api-docs::' . $appVersion;
|
||||||
if (Cache::has($cacheKey) && config('app.env') === 'production') {
|
$isProduction = config('app.env') === 'production';
|
||||||
$docs = Cache::get($cacheKey);
|
$cacheVal = $isProduction ? Cache::get($cacheKey) : null;
|
||||||
} else {
|
|
||||||
$docs = (new ApiDocsGenerator())->generate();
|
if (!is_null($cacheVal)) {
|
||||||
Cache::put($cacheKey, $docs, 60 * 24);
|
return $cacheVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$docs = (new ApiDocsGenerator())->generate();
|
||||||
|
Cache::put($cacheKey, $docs, 60 * 24);
|
||||||
|
|
||||||
return $docs;
|
return $docs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('cache', function (Blueprint $table) {
|
||||||
|
$table->mediumText('value')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('cache', function (Blueprint $table) {
|
||||||
|
$table->text('value')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in a new issue