Update dependencies

Composer: Laravel 13.43, Octane 2.25, Fortify 1.43 and Pest 5.3.7,
with the packages they bring (70 in all). This fixes the advisories
in Laravel and the Symfony components. npm: Vite 8.3.8 with Rolldown
1.2.19, Playwright 1.65.1 and chokidar 6. The asset build, CI and the
dev container use Node.js 26. The dev image also has git for
Composer. Both audits are clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-19 06:45:31 +01:00
co-authored by Claude Opus 5.5
parent cf73052e0e
commit 5679e62c78
41 changed files with 1432 additions and 1226 deletions
@@ -1,10 +1,10 @@
# Caching Best Practices
# Caching best practices
## Use `Cache::remember()` for Cache-Aside Reads
## Use `Cache::remember()` for cache-aside reads
`Cache::remember()` implements a cache-aside read without a separate truthiness check. It does not prevent concurrent requests from computing the same missing value; use an atomic lock when duplicate computation must be prevented.
`Cache::remember()` implements a cache-aside read without a separate truthiness check. It does not prevent concurrent requests from computing the same missing value. When you must prevent duplicate computation, use an atomic lock.
The manual version below incorrectly treats valid falsy values, such as `false` or `0`, as cache misses.
The manual version below treats valid falsy values, such as `false` or `0`, as cache misses.
Incorrect:
@@ -22,9 +22,9 @@ Correct:
$val = Cache::remember('stats', 60, fn () => $this->computeStats());
```
## Consider `Cache::flexible()` for Stale-While-Revalidate
## Consider `Cache::flexible()` for stale-while-revalidate
For frequently read keys, `Cache::flexible()` can serve stale data during a defined stale period and register a deferred refresh. During an HTTP request, that refresh normally runs after the response; it is not a durable background job. Once the stale period has elapsed, the request recomputes the value synchronously.
For frequently read keys, `Cache::flexible()` can serve stale data during a defined stale period and register a deferred refresh. During an HTTP request, that refresh normally runs after the response. The refresh is not a durable background job. After the stale period ends, the request recomputes the value synchronously.
Synchronous expiration:
@@ -38,11 +38,11 @@ Stale-while-revalidate tradeoff:
Cache::flexible('users', [300, 600], fn () => User::all());
```
This value is fresh for five minutes and may be served stale until ten minutes after it was cached.
In this example, the value is fresh for five minutes. Laravel may serve the stale value until ten minutes after it was cached.
## Use `Cache::memo()` to Avoid Redundant Hits Within an Execution
## Use `Cache::memo()` to avoid redundant hits within an execution
If the same cache key is read repeatedly during one request or job, `memo()` decorates a cache store and retains resolved values in memory for that execution.
When code reads the same cache key repeatedly during one request or job, `memo()` decorates a cache store and keeps resolved values in memory for that execution.
```php
$settings = Cache::memo()->get('settings');
@@ -50,15 +50,15 @@ $settings = Cache::memo()->get('settings');
Repeated reads through the same memoized store avoid additional store lookups. Writes through the memoized store update or invalidate its in-memory values as appropriate.
## Use Cache Tags to Invalidate Related Groups
## Use cache tags to invalidate related groups
Tags group related entries for invalidation without tracking each key. Cache tags are not supported by the `file`, `dynamodb`, or `database` drivers; confirm support before choosing a store.
Tags group related entries for invalidation without tracking each key. The `file`, `dynamodb`, and `database` drivers do not support cache tags. Confirm that a store supports tags before you choose it.
```php
Cache::tags(['user-1'])->flush();
```
## Use `Cache::add()` for Atomic Conditional Writes
## Use `Cache::add()` for atomic conditional writes
`add()` atomically writes a value only when the key does not already exist.
@@ -76,9 +76,9 @@ Correct:
Cache::add('lock', true, 10);
```
Use `Cache::lock()` rather than an ordinary cache key when lock ownership and safe release are required.
When you need lock ownership and safe release, use `Cache::lock()` instead of an ordinary cache key.
## Use `once()` for In-Process Memoization
## Use `once()` for in-process memoization
`once()` memoizes a callback's return value for the current request or job. Calls made from an object instance are scoped to that instance. Unlike `Cache::memo()`, `once()` does not read from an external cache store.
@@ -91,9 +91,9 @@ public function roles(): Collection
Repeated calls return the memoized result without rerunning the callback. Use `once()` for repeated computation within one execution. Use `Cache::memo()` to memoize access to an underlying store that can also persist values across executions.
## Configure Failover Cache Stores in Production
## Configure failover cache stores in production
The failover driver tries each configured store in order when a store operation throws an exception. It does not consult later stores for an ordinary cache miss, and data is not replicated between stores.
The failover driver tries each configured store in order when a store operation throws an exception. It does not consult later stores for an ordinary cache miss, and it does not replicate data between stores.
```php
'failover' => ['driver' => 'failover', 'stores' => ['redis', 'database']],