以每小时 20 美元的价格聘请具备人工智能专业知识的 Laravel 开发人员。48 小时内即可开始工作。

Storage Cache Store in Laravel 13.10.0

最后更新于 经过

Storage Cache Store in Laravel 13.10.0 image

Laravel v13.10.0 introduces a storage cache driver backed by Laravel's filesystem abstraction, making it possible to use an S3 disk (or any configured disk) as a key/value cache store without additional packages. It also adds a --stop-when-empty-for queue worker option, a WorkerIdle event, schedule group lifecycle callbacks, Schema::hasForeignKey() , and several queue testing improvements.

  • 新的 storage cache driver backed by Laravel's filesystem
  • --stop-when-empty-for queue worker option
  • WorkerIdle event for idle worker detection
  • Lifecycle and output callbacks on Schedule::group()
  • Schema::hasForeignKey() 帮手
  • queue:failed --json output option
  • assertPushedOnce() testing helper
  • Enum queue names in QueueFake
  • WorkerOptions passed to additional worker events

什么是新的

Storage Cache Store

新的 storage cache driver uses Laravel's filesystem / Storage services to store cached values. This is primarily useful for using an existing S3 disk as a key/value cache — no Redis or Memcached required.

默认 config/cache.php 现在包括 storage store entry:

'贮存' => [
'司机' => '贮存' ,
'磁盘' => 环境 'CACHE_STORAGE_DISK' ),
'小路' => 环境 'CACHE_STORAGE_PATH' , 'framework/cache/data' ),
],

观点 CACHE_STORAGE_DISK at any configured disk (including s3 ) and the cache driver will read and write values through Laravel's filesystem layer. Each cached value is stored as a file containing a serialized payload with an expiration timestamp.

公关稿: #60131 经过 @泰勒韦尔

Queue Worker Idle Stop Option

queue:work 现在接受一个 --stop-when-empty-for option that stops the worker after it has gone a configured number of seconds without processing any jobs:

php 工匠 队列:工作 --stop-when-empty-for=60

This stops the worker if no jobs have been processed for 60 seconds. It's useful for short-lived workers, scaled-down environments, or any situation where you want workers to exit automatically when queues go quiet rather than running indefinitely.

公关稿: #60176 经过 @泰勒韦尔

Worker Idle Event

新的 WorkerIdle event is dispatched when a queue worker checks for a job and finds the queue empty. This is distinct from JobPopping , which fires on every pop attempt regardless of whether a job was found. Listening to WorkerIdle lets you detect workers that are genuinely unused — useful for rebalancing worker capacity or logging idle time.

公关稿: #60134 经过 @jackbayliss

Worker Configuration Passed to Additional Worker Events

WorkerOptions (which includes the --name flag and other worker configuration) is now passed to the Pausing , Resuming , Interrupted , 和 Looping worker events. Previously these events did not include the worker's configuration, making it harder to know which worker instance was involved in a listener.

PR: #60135 , #60153 经过 @jackbayliss

Schedule Group Lifecycle Callbacks

Schedule::group() now supports the same lifecycle and output callback methods available on individual events. This lets you attach callbacks once for an entire group instead of repeating them on each task:

日程 :: 团体 功能 日程 $schedule) {
$时间表 -> 命令 'reports:generate' (英文):
$时间表 -> 命令 'reports:email' (英文):
}) -> 失败 功能 (){
// fires for any failing task in the group
}) -> 成功时 功能 (){
// fires when each task in the group succeeds
});

公关稿: #60133 经过 @cosmastech

Scheduled Event Instance in Callbacks

Scheduled event callbacks (such as onSuccess , onFailure , 和 then ) can now optionally receive the Event instance as a parameter. This gives the callback direct access to the event's configuration — its command, output path, and other properties:

$时间表 -> 命令 'reports:generate'
-> 失败 功能 事件 $event) {
日志 :: 错误 "Scheduled task failed: { $事件 -> 命令 }” (英文):
});

公关稿: #60144 经过 @cosmastech

Schema Foreign Key Existence Helper

新的 Schema::hasForeignKey() method checks whether a specific foreign key constraint exists on a table, complementing the existing getForeignKeys()hasIndex() 帮手:

如果 架构 :: hasForeignKey “命令” ,[ '用户身份' ])){
架构 :: 桌子 “命令” , 功能 蓝图 $table) {
$表 -> 外国的 '用户身份' -> 参考 'ID' -> “用户” (英文):
});
}

This is useful in migrations, package install scripts, and schema assertions where you want to avoid adding a foreign key that already exists.

公关稿: #60169 经过 @Tresor-Kasenda

JSON Output for Failed Jobs

queue:failed Artisan command now accepts a --json flag, outputting failed jobs as JSON. Each entry includes id , connection , queue , class , 和 failed_at . An empty result returns [] . This matches the --json support already available on route:list , db:show , queue:monitor , and other commands.

公关稿: #60168 经过 @Tresor-Kasenda

SQS Overflow Flush on Queue Clear

The SQS extended store (added in 13.9.0) now supports a flush_on_clear option. When enabled, running queue:clear will also call flush() on the configured overflow cache store after purging SQS, reclaiming storage immediately rather than waiting for TTL expiration. This matters for S3-backed stores where leftover objects incur ongoing cost:

'平方' => [
// ...
'extended_store_options' => [
‘已启用’ => 真的 ,
'磁盘' => 's3' ,
'flush_on_clear' => 真的 ,
],
],

This option defaults to false to preserve existing behavior. Note that for most cache stores, flush() wipes the entire store — point overflow.store at a dedicated cache store (the new storage driver is a natural fit here) to avoid unintended data loss.

公关稿: #60138 经过 @Orrison

Assert Job Pushed Once

Queue::assertPushedOnce() is a more readable alternative to Queue::assertPushedTimes(JobClass::class, 1) :

// 前
队列 :: assertPushedTimes ProcessOrderJob ::班级 , 1 (英文):
// 后
队列 :: assertPushedOnce ProcessOrderJob ::班级 (英文):

公关稿: #60150 经过 @weshooper

Enum Queue Names in Fake Queue Assertions

QueueFake now normalizes enum queue names the same way the real queue driver does. Passing a UnitEnum case as a queue name to push() , size() , 或者 pendingJobs() now works correctly, and assertions against enum queue names behave consistently with their string equivalents.

公关稿: #60161 经过 @Tresor-Kasenda

Cloud Request ID in Logs

For applications running on Laravel Cloud, the request ID is now output in log entries using a custom JSON formatter. It appears as a standalone field rather than being nested inside the Monolog context 或者 extra 块。

公关稿: #60156 经过 @jradtilbrook

其他修复和改进

  • 使固定 starts_with / ends_with rejecting numeric values — these validation rules now correctly handle numeric input by casting to string before comparison, restoring behavior from Laravel 12 ( #60120 经过 @aydinfatih
  • URL encode paths for signed URLs — storage paths are now URL-encoded before being placed into signed route path segments, fixing temporary signed URLs that contain ? , & , 或者 # characters ( #60137 经过 @泰勒韦尔
  • Delimit aggregate alias — SQL aggregate function aliases are now delimited to prevent conflicts with reserved words ( #60140 经过 @willrowe
  • Optimize Worker queue pause check — the queue worker's pause check is now more efficient ( #60109 经过 @jackbayliss
  • Validate against line breaks in emails — email validation now rejects values containing line breaks ( #60151 经过 @泰勒韦尔

参考

保罗·雷德蒙德照片

Laravel News 特约撰稿人。全栈 Web 开发人员兼作家。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
SerpApi

适用于您的 LLM 和 AI 应用的 Web 搜索 API

访问 SerpApi
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

SerpApi
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
Laravel MongoDB Full-Text Search tutorial: The Art of the Relevancy image

Laravel MongoDB Full-Text Search tutorial: The Art of the Relevancy

阅读文章
Drag-and-Drop Sorting for Eloquent Models with Reorderable for Laravel image

Drag-and-Drop Sorting for Eloquent Models with Reorderable for Laravel

阅读文章
Ship AI with Laravel: Real-Time Streaming Chat UI with Livewire image

Ship AI with Laravel: Real-Time Streaming Chat UI with Livewire

阅读文章
Frontend Nation 2026 Returns June 3-4 with Laravel in the Lineup image

Frontend Nation 2026 Returns June 3-4 with Laravel in the Lineup

阅读文章
Use a Google Sheet as Your Laravel Database with the Google Sheets Database Driver image

Use a Google Sheet as Your Laravel Database with the Google Sheets Database Driver

阅读文章
Larapanda: A Type-Safe Lightpanda Browser SDK for Laravel image

Larapanda: A Type-Safe Lightpanda Browser SDK for Laravel

阅读文章