一键导入
laravel-performance-caching
Use framework caches and value/query caching to reduce work; add tags, locks, and explicit invalidation strategies for correctness
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use framework caches and value/query caching to reduce work; add tags, locks, and explicit invalidation strategies for correctness
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | laravel:performance-caching |
| description | Use framework caches and value/query caching to reduce work; add tags, locks, and explicit invalidation strategies for correctness |
php artisan route:cache
php artisan config:cache
php artisan view:cache
Clear with the corresponding clear commands when needed in deployments.
Cache::remember("post:{$id}", 600, fn () => Post::findOrFail($id));
// Stable keys and scopes (e.g., tenant, locale)
Cache::remember("tenant:{$tenantId}:users:index:page:1", now()->addMinutes(5), function () {
return User::with('team')->paginate(50);
});
// Tags (supported drivers) for grouped invalidation
Cache::tags(['users'])->remember('users.index.page.1', now()->addMinutes(5), fn () => ...);
Cache::tags(['users'])->flush();
// Locks to ensure exclusive expensive work
Cache::lock('reports:daily', 30)->block(5, function () {
generateReports();
});
remember() to prevent thundering herds// Extend TTL without re-fetching/re-storing the value
Cache::touch('user_session:123', 3600);
Cache::touch('analytics_data', now()->addHours(6));
// Filesystem-backed "storage" cache driver (e.g., S3 as a K/V store)
// config/cache.php
'storage' => [
'driver' => 'storage',
'disk' => env('CACHE_STORAGE_DISK', 's3'),
'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'),
],
serializable_classes is false in config/cache.php; allow-list classes you cache as objectsCACHE_PREFIX/REDIS_PREFIX explicitly to avoid cold caches on upgradeBuild AI features with the first-party Laravel AI SDK (Laravel 13+); agents, embeddings, images, audio, and tool calling with provider-agnostic APIs
Use API Resources with pagination and conditional fields; keep response shapes stable and cache-friendly
Compose UIs with Blade components, slots, and layouts; keep templates pure and testable
Request effective code reviews—specify focus areas, provide context, ask for architectural feedback, reference Laravel conventions
Practical daily checklist for Laravel projects; bring services up, run migrations, queues, quality gates, and tests
Create effective debugging prompts—include error messages, stack traces, expected vs actual behavior, logs, and attempted solutions