File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
system/Commands/Utilities
user_guide_src/source/general Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 1313
1414namespace CodeIgniter \Commands \Utilities ;
1515
16+ use CodeIgniter \Cache \FactoriesCache ;
1617use CodeIgniter \CLI \BaseCommand ;
1718use CodeIgniter \CLI \CLI ;
1819use CodeIgniter \Config \BaseConfig ;
20+ use Config \Optimize ;
1921use Kint \Kint ;
2022
2123/**
@@ -87,6 +89,14 @@ public function run(array $params)
8789 /** @var class-string<BaseConfig> $class */
8890 $ class = $ params [0 ];
8991
92+ // Load Config cache if it is enabled.
93+ $ configCacheEnabled = class_exists (Optimize::class)
94+ && (new Optimize ())->configCacheEnabled ;
95+ if ($ configCacheEnabled ) {
96+ $ factoriesCache = new FactoriesCache ();
97+ $ factoriesCache ->load ('config ' );
98+ }
99+
90100 $ config = config ($ class );
91101
92102 if ($ config === null ) {
@@ -103,6 +113,10 @@ public function run(array $params)
103113 );
104114 }
105115
116+ CLI ::newLine ();
117+ $ state = CLI ::color ($ configCacheEnabled ? 'Enabled ' : 'Disabled ' , 'green ' );
118+ CLI ::write ('Config Caching: ' . $ state );
119+
106120 return EXIT_SUCCESS ;
107121 }
108122
Original file line number Diff line number Diff line change @@ -378,10 +378,11 @@ Confirming Config Values
378378************************
379379
380380The actual Config object property values are changed at runtime by the :ref: `registrars `
381- and :ref: `Environment Variables <configuration-classes-and-environment-variables >`.
381+ and :ref: `Environment Variables <configuration-classes-and-environment-variables >`,
382+ and :ref: `factories-config-caching `.
382383
383384CodeIgniter has the following :doc: `command <../cli/spark_commands >` to check
384- Config values.
385+ the actual Config values.
385386
386387.. _spark-config-check :
387388
@@ -417,3 +418,9 @@ The output is like the following:
417418 public 'CSPEnabled' -> boolean false
418419 )
419420
421+ Config Caching: Disabled
422+
423+ You can see if Config Caching is eabled or not.
424+
425+ .. note :: If Config Caching is enabled, the cached values are used permanently.
426+ See :ref: `factories-config-caching ` for details.
You can’t perform that action at this time.
0 commit comments