X
X
XenK2015-10-21 11:23:47
Phalcon
XenK, 2015-10-21 11:23:47

How to disable cache on Phalcon?

When creating a view (volt), a cache is automatically created in the "../app/cache" folder, how can I disable it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
My joy, 2016-04-05
@t-alexashka

If you need templates to be recompiled every time, enable the compileAlways option option in Volt's settings. In this case, the cache files will still be created, but each time anew, regardless of whether there were changes in them or not.

$di->set('view', function(){
    $view = new \Phalcon\Mvc\View();
    $view->setViewsDir('../app/views/');

        $view->registerEngines(array(
            '.volt' => function($view, $di) {
            $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
            $volt->setOptions(array(
              'compiledPath' => '../app/compiled/',
              'stat' => true,
              'compileAlways' => true  
            ));
            return $volt;
            }
        ));

    return $view;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question