我和一些朋友决定开始做一个项目,我们遇到了拉威尔,认为这可能是一个很好的工具.我们开始在本地使用它来开发我们的一些页面,并注意到一些奇怪的事情.

When we update a view with different information, it would take almost 5 to 10 minutes before the views information would change. It's like Laravel is caching the view and put a TTL on it.

I know this isn't anything I am doing on my local web server because I have used other frameworks and I have never encountered this issue.

Upon searching the Internet, I can't find a great answer on how to disable this. I want to use Laravel, but find it worthless if it takes a while for my views to update each time I want to make a change. In fact, it sounds counter productive.

Is there any way to disable this? Why are my views taking forever to update right out of the box?

推荐答案

The #laravel IRC channel is a God send. This had nothing to do with Laravel's behavior at all. This was actually something PHP 5.5 was doing.

The reason this was so baffling is because I upgraded my PHP version from 5.3 and never had this issue.

在你的房间里.ini文件,您需要调整OPcache设置.对我来说,这些设置从第1087行开始.ini文件,看起来像这样:

opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

请特别注意opcache.revalidate_freq=60.这就是让视图缓存的真正原因.如果这不是所需的行为,请将该值设置为0,每次进行更改时,视图都会更新.耶!

EDIT AUGUST 21, 2014

正如Matt在下面提到的,确保重新启动您的web服务器,以查看您的更改在更改后生效.ini文件.

Laravel相关问答推荐

Nuxt 3获取多部分表单数据上传不起作用

从8.0更新到10.0后,图像不再上传到存储

Laravel将变量从模板到已发布的供应商模板

使用Laravel判断其他数据库中是否存在记录

如何使用 Laravel 进行继承

如何在 Laravel 中使用 return 停止 Trait php 的执行

Vue 组件中的图像不适用于 Vite + Laravel

当两个外键都在同一个表上时创建直通关系

Laravel 获取具有多对多关系的中间表数据

如何保存/重定向 Laravel Artisan 命令的输出?

在laravel中将数据插入数据透视表

在 Laravel 中下载后如何重定向?

如何将Carbon 转换为字符串,只取日期?

Laravel 初学者的良好开端

Laravel - 更新时禁用更新时间

在Lumen框架中启用会话

配置和测试 Laravel 任务调度

使用 Nginx 设置 Laravel

如何在 Laravel 中 Refresh刷新用户对象?

如何在 laravel 表单验证错误消息中给出自定义字段名称