Hi,
I just work on optimizing the caching of the website with Redis since I need tagged cache on several spots.
A second developer needed a quick workaround without the installation of Redis so I thought “array” as CACHE_DRIVER would be a good alternative.
However, it turned out that with array, some combined assets show an error message and the CSS is gone obviously. So I tested this on two platforms (one ubuntu, one windows) with CACHE_DRIVER “file” (removing the tagged cache code for a moment), “array” and “redis”.
While the combine files worked fine with “file” and “redis” on both platforms, “array” showed the same problem on both platforms.
What is the problem here?
Since this only happens on caching driver “array” I’m not sure if this might be a bug from october. Any help is welcome here. ^^
I also tried this approach adding the .css to the href of the linked css, but it didnt work:
.env:
CACHE_DRIVER=array
config/cache.php:
'array' => [
'driver' => 'array',
'serialize' => false,
],
config/cms.php => still the default one
CSS Partial from the Layout:
{# Styles #}
<link href="{{ ['assets/css/theme.scss']|theme }}" rel="stylesheet" />
{% if this.page.is_logged_in %}
<link href="{{ ['assets/css/user.scss']|theme }}" rel="stylesheet" />
{% endif %}
{% if this.page.hide_ads %}
<link href="{{ ['assets/css/premium.scss']|theme }}" rel="stylesheet" />
{% else %}
<link href="{{ ['assets/css/layout.scss']|theme }}" rel="stylesheet" />
{% endif %}
{% styles %}
{# Bootstrap #}
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous" />
HTML Output:
<link href="[myurl]/combine/6325f3647ca682b1416b1141509e2aa0-1684519928" rel="stylesheet" />
<link href="[myurl]/combine/c9914be9448a97e3f7dc2683bc6cb748-1681711805" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous" />
Combiner File:
ApplicationException: The combiner file 'c9914be9448a97e3f7dc2683bc6cb748' is not found. in [webfolder]\modules\system\classes\CombineAssets.php:217
Stack trace:
#0 [webfolder]\modules\system\classes\SystemController.php(38): System\Classes\CombineAssets->getContents('c9914be9448a97e...')
#1 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(54): System\Classes\SystemController->combine('c9914be9448a97e...')
#2 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(43): Illuminate\Routing\Controller->callAction('combine', Array)
#3 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Route.php(260): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(System\Classes\SystemController), 'combine')
#4 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Route.php(205): Illuminate\Routing\Route->runController()
#5 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Router.php(798): Illuminate\Routing\Route->run()
#6 [webfolder]\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#7 [webfolder]\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#8 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Router.php(799): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#9 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Router.php(776): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#10 [webfolder]\vendor\laravel\framework\src\Illuminate\Routing\Router.php(740): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#11 [webfolder]\vendor\october\rain\src\Router\CoreRouter.php(32): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#12 [webfolder]\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(190): October\Rain\Router\CoreRouter->dispatch(Object(Illuminate\Http\Request))
#13 [webfolder]\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(141): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#14 [webfolder]\vendor\barryvdh\laravel-debugbar\src\Middleware\InjectDebugbar.php(66): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#15 [webfolder]\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 [webfolder]\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 [webfolder]\vendor\october\rain\src\Foundation\Http\Middleware\CheckForMaintenanceMode.php(23): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#18 [webfolder]\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(180): October\Rain\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 [webfolder]\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php(116): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 [webfolder]\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(165): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#21 [webfolder]\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(134): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#22 [webfolder]\index.php(43): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#23 {main}
...