laravel-caching-strategies
Laravel Caching Strategies
Core Cache Patterns
use Illuminate\Support\Facades\Cache;
// ✅ remember - cache for a duration
$users = Cache::remember('users:active', now()->addMinutes(30), function () {
return User::where('active', true)->get();
});
// ✅ rememberForever - cache until manually cleared
$settings = Cache::rememberForever('app:settings', function () {
return Setting::all()->pluck('value', 'key');
});
More from iserter/laravel-claude-agents
eloquent-best-practices
Best practices for Laravel Eloquent ORM including query optimization, relationship management, and avoiding common pitfalls like N+1 queries.
939laravel-tdd
Test-Driven Development specifically for Laravel applications using Pest PHP. Use when implementing any Laravel feature or bugfix - write the test first, watch it fail, write minimal code to pass.
269api-resource-patterns
Best practices for Laravel API Resources including resource transformation, collection handling, conditional attributes, and relationship loading.
110systematic-debugging-laravel
Systematic debugging process for Laravel applications - ensures root cause investigation before attempting fixes. Use for any Laravel issue (test failures, bugs, unexpected behavior, performance problems).
82brainstorming-laravel
Use when creating or developing Laravel features, before writing code or implementation plans - refines rough ideas into fully-formed Laravel designs through collaborative questioning, alternative exploration, and incremental validation.
80laravel-validation-patterns
Best practices for Laravel validation including Form Requests, custom rules, conditional validation, and input sanitization.
47