We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

compileAlways Not Working for Me

This is the function I'm using.

$di->set('view', function() {
    $view = new Phalcon\Mvc\View();
    $view->setViewsDir('../app/views/');
    $view->registerEngines(array(
        ".phtml" => function($view, $di) {
            $volt = new Phalcon\Mvc\View\Engine\Volt($view, $di);
            $volt->setOptions(array(
                'compiledPath' => '../app/cache/',
                'compiledExtension' => '.compiled',
                'compileAlways' => true,
                'stat' => true
            )); #options
            return $volt;
    })); #register
    return $view;
}); #view

Any ideas why I still see cached files in /app/cache/ ? It's very anoying having to delete this files manually when developing.

Thank You!



98.9k
Accepted
answer

Files are generated at every request but they're re-generated again and again if compileAlways is true



16.6k

@Phalcon, oh I see. Is there a way to disable creation of those files ? It would be nice to have some option that allows you completely disable the cache. Thanks.

I think it's not possible to deactivate the cache because volt/phtml templates must be translated into php to get rendered on the server.