| @@ -4,9 +4,8 @@ | ||
| 4 | 4 | |
| 5 | 5 | use FluentCart\Api\StoreSettings; |
| 6 | 6 | use FluentCart\App\Modules\PaymentMethods\Core\GatewayManager; |
| 7 | 7 | use FluentCart\App\Modules\PaymentMethods\Core\PaymentGatewayInterface; |
| 8 | -use FluentCart\Framework\Support\Once; | |
| 9 | 8 | use FluentCart\Framework\Foundation\App as AppFacade; |
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * Class App |
| @@ -44,11 +43,17 @@ | ||
| 44 | 43 | } |
| 45 | 44 | |
| 46 | 45 | public static function storeSettings(): StoreSettings |
| 47 | 46 | { |
| 48 | - return Once::call(function () { | |
| 49 | - return new StoreSettings(); | |
| 50 | - }); | |
| 47 | + $cached = wp_cache_get(StoreSettings::CACHE_KEY, StoreSettings::CACHE_GROUP); | |
| 48 | + if ($cached instanceof StoreSettings) { | |
| 49 | + return $cached; | |
| 50 | + } | |
| 51 | + | |
| 52 | + $storeSettings = new StoreSettings(); | |
| 53 | + wp_cache_set(StoreSettings::CACHE_KEY, $storeSettings, StoreSettings::CACHE_GROUP); | |
| 54 | + | |
| 55 | + return $storeSettings; | |
| 51 | 56 | } |
| 52 | 57 | |
| 53 | 58 | /** |
| 54 | 59 | * Get the payment gateway manager or a specific gateway |