We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cfb4926 commit b1da40fCopy full SHA for b1da40f
laravel/src/SyncApiConstant.php
@@ -4,6 +4,7 @@
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\Str;
7
+use Illuminate\Support\Facades\Cache;
8
9
/**
10
* Represents a constant within a sync API. Create instances using
@@ -99,10 +100,16 @@ public function hashData(array $data): string
99
100
101
public function generateConstantRoutes(): void
102
{
103
+ $kebabCasedName = $this->generateKebabCasedName();
104
+
105
Route::get(
- $this->generateKebabCasedName(),
- function () {
- $data = ($this->valueFactory)();
106
+ $kebabCasedName,
107
+ function () use ($kebabCasedName) {
108
+ $data = Cache::remember(
109
+ 'sync_api_constant_' . $kebabCasedName,
110
+ 3600,
111
+ $this->valueFactory
112
+ );
113
114
return [
115
'version' => $this->hashData($data),
0 commit comments