@@ -140,3 +140,50 @@ autoloader will be the first one to get a chance to locate the file.
140
140
141
141
.. note :: Prior to v4.5.0, if the same namespace was defined in both CodeIgniter and Composer, CodeIgniter's autoloader was
142
142
the first one to get a chance to locate the file.
143
+
144
+ .. _file-locator-caching :
145
+
146
+ FileLocator Caching
147
+ *******************
148
+
149
+ .. versionadded :: 4.5.0
150
+
151
+ **FileLocator ** is responsible for finding files or getting a classname from a file,
152
+ which cannot be achieved with PHP autoloading.
153
+
154
+ To improve its performance, FileLocator Caching has been implemented.
155
+
156
+ How It Works
157
+ ============
158
+
159
+ - Save the all found data by FileLocator into a cache file when destructing,
160
+ if the cache data is updated.
161
+ - Restore cached data when instantiating if cached data is available.
162
+
163
+ The cached data are used permanently.
164
+
165
+ How to Delete Cached Data
166
+ =========================
167
+
168
+ Once stored, the cached data never expire.
169
+
170
+ So if you add or remove files or change existing file paths, or namespaces, old
171
+ cached data will be returned and your app may not work properly.
172
+
173
+ In that case, you must manually delete the cache file. If you add a CodeIgniter
174
+ package via Composer, you also need to delete the cache file.
175
+
176
+ You can use the ``spark cache:clear `` command:
177
+
178
+ .. code-block :: console
179
+
180
+ php spark cache:clear
181
+
182
+ Or simply delete the **writable/cache/FileLocatorCache ** file.
183
+
184
+ How to Enable FileLocator Caching
185
+ =================================
186
+
187
+ Add the following code in **app/Config/Services.php **:
188
+
189
+ .. literalinclude :: autoloader/004.php
0 commit comments