LaravelPaul Redmond2 min readintermediate
Memoize Tagged Cache Reads in Laravel
Summary
Laravel 13.33 adds tag support to its memoized cache, letting you cache‑once per request and serve subsequent reads from memory. Use it for request‑scoped immutable data like permissions to avoid repeated store hits, but remember writes invalidate the memoized copy.
- Call `Cache::memo()->tags([...])` to memoize a tagged cache entry for the duration of a request or job.
- After the first read the value is served from memory; any write (put, increment, etc.) clears the memoized copy so the next read hits the store.
- Ideal for data that doesn’t change during a request, such as permission sets or configuration settings.
- Avoid for counters or data that other processes may update mid‑request, as memoization can hide those changes.
Laravel engineers building high‑traffic applications can reduce redundant cache reads and improve request latency by memoizing tagged values that stay constant during a request.
6/10



/)
