Hello, I use memcache with queries and is OK. Apart of this I want to cache my phtml views with memcache, but I don't know how :(
I started to save the views in a folder with this and works fine....
$view->registerEngines([
//'.phtml' => PhpEngine::class // asà estaba antes y con lo de abajo aparecen las view en /tmp/cache
'.phtml' => function($view, $di) {
$phtml = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$phtml->setOptions(array(
"compiledPath" => BASE_PATH . '/tmp/cache/',
'compiledSeparator' => '_',
'compileAlways' => false,
));
return $phtml;
}
]);
...but I dom't know how to serve those pages saved into BASE_PATH . '/tmp/cache/', instead render the view again.
My code in services.php
use Phalcon\Cache\Frontend\Data as FrontendData;
use Phalcon\Cache\Backend\Memcache as BackendMemcache;
$di->setShared(
'modelsCache',
function () {
$config = $this->getConfig();
// Cache data for one day (default setting)
$frontCache = new FrontendData(
[
'lifetime' => 86400
]
);
// Memcached connection settings
$cache = new BackendMemcache(
$frontCache,
[
'host' => 'localhost'
'port' => '11211',
]
);
return $cache;
}
);
With this the pages is rendering again and again.
Any clue, any idea?
Regards.