2121use Drift \HttpKernel \DependencyInjection \CompilerPass \FilesystemCompilerPass ;
2222use Drift \HttpKernel \DependencyInjection \CompilerPass \PeriodicTimersCompilerPass ;
2323use Drift \HttpKernel \Exception \AsyncHttpKernelNeededException ;
24+ use Drift \HttpKernel \PeriodicTimer \PeriodicTimer ;
2425use Exception ;
2526use React \Promise \PromiseInterface ;
2627use Symfony \Component \Filesystem \Filesystem ;
@@ -46,14 +47,17 @@ public function boot()
4647 {
4748 if (!$ this ->booted ) {
4849 $ this ->uid = $ this ->generateUID ();
49- $ fs = new Filesystem ();
50- // AsyncKernel loads the container only once when it loads. Storing it in the filesystem is not for cache purposes
51- // but more for using the same loading process as Kernel class use.
52- // Hence, everytime before AsyncKernel initiates the container it deletes the cache dir,
53- // to make sure it is building the updated kernel
54- $ cachePath = $ this ->getCacheDir ();
55- if ($ fs ->exists ($ cachePath )) {
56- $ fs ->remove ($ cachePath );
50+
51+ if (($ _ENV ['DRIFT_CACHE_ENABLED ' ] ?? '0 ' ) !== '1 ' ) {
52+ $ fs = new Filesystem ();
53+ // AsyncKernel loads the container only once when it loads. Storing it in the filesystem is not for cache purposes
54+ // but more for using the same loading process as Kernel class use.
55+ // Hence, everytime before AsyncKernel initiates the container it deletes the cache dir,
56+ // to make sure it is building the updated kernel
57+ $ cachePath = $ this ->getCacheDir ();
58+ if ($ fs ->exists ($ cachePath )) {
59+ $ fs ->remove ($ cachePath );
60+ }
5761 }
5862 }
5963
0 commit comments