Cache refreshing ?
Closed this issue · 3 comments
Hi,
When I update a view I don't see the modifications reflected in the browser.
I configure the php directive opcache.revalidate_freq=0
. The file timestamp is correctly modified on the machine.
The only way to see the modifications is to manually clear the cache folder in the project.
Anybody knows a workaround for this ?
I wrote this little test and it fails, even when the sleep
step is active.
// tests/views/refresh.blade.php file containing "Initial content"
public function testRefresh()
{
$initial_output = $this->blade->make('refresh')->render();
$this->assertEquals(
'Initial content',
trim($initial_output),
'The view output is equal to the file initial content'
);
$this->modifyView('Modified content', 'refresh');
// sleep(1); // wait 1 second to make sure...
$refreshed_output = $this->blade->make('refresh')->render();
$this->modifyView($initial_content, 'refresh');
$this->assertEquals(
'Modified content',
trim($refreshed_output),
'The view output is equal to the file modified content'
);
}
// ...
private function modifyView($content, $view_name)
{
$view_path = "{$this->blade->viewPaths}/{$view_name}.blade.php";
file_put_contents($view_path, $content);
}
This has nothing to do with your package, sorry. It has something to do with the virtual machine server configuration I use... If I use the PHP server everything works perfect !
In case someone has the same issue, as I said it had nothing to do with this package !
It was "just" a write access problem to the cache
folder and the files created. I am currently using a vagrant virtual machine and I fixed the problem by changing the user and group executing apache server to vagrant
in /etc/apache2/envvars
file.