responsecache-development

Cache HTTP responses in Laravel using spatie/laravel-responsecache middleware.

Updated Dec 19, 2025
One-click install
npx skills add https://github.com/beardcoder/mens-circle --skill responsecache-development
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: responsecache-development
Source: https://github.com/beardcoder/mens-circle/tree/main/.agents/skills/responsecache-development
Command: npx skills add https://github.com/beardcoder/mens-circle --skill responsecache-development

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Response caching for Laravel apps reduces latency and server load by storing entire HTTP responses, enabling faster subsequent requests.

Core Features & Use Cases

  • Cache whole responses via CacheResponse middleware with configurable lifetimes and optional tags.
  • Enable flexible caching with FlexibleCacheResponse (stale-while-revalidate) and graceful refresh.
  • Control caching per action with attributes (Cache, FlexibleCache, NoCache) or middleware on routes.
  • Manage cached items with custom cache profiles, replacers, and selective clearing.
  • Integrate custom hashers and serializers for cache keys and responses.

Quick Start

Configure Laravel to use the CacheResponse middleware on a route to cache the response with a default lifetime, or customize with lifetime, tags, and profiles.

Frequently Asked Questions about responsecache-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I cache HTTP responses in Laravel to reduce server load?

Caching HTTP responses in Laravel stores entire response outputs to reduce latency and server load. Apply the CacheResponse middleware to routes to cache responses with a default lifetime, or customize lifetimes and tags via config/responsecache.php.

Does Laravel response caching support stale-while-revalidate behavior?

Flexible caching in Laravel response caching supports stale-while-revalidate behavior and graceful refresh. Enable it using the FlexibleCacheResponse middleware alongside the FlexibleCache attribute to serve stale content while refreshing in the background.

How do I control which Laravel routes are cached or excluded from caching?

Control Laravel route caching per action using attributes like Cache, FlexibleCache, or NoCache. Alternatively, apply the CacheResponse middleware directly to specific routes, and use custom cache profiles to determine exactly which requests qualify for caching.

Can I customize cache keys and response storage when caching Laravel responses?

Customizing Laravel response cache keys and storage is supported through custom hasher and serializer implementations. Define these within the config/responsecache.php configuration file to control how cache keys are generated and responses are serialized.

How do I selectively clear cached Laravel responses without flushing everything?

Selective clearing of cached Laravel responses is managed using optional tags assigned during caching. Tag specific routes when applying the CacheResponse middleware, then clear only those tagged cached items instead of flushing the entire cache.

What is a cache profile in Laravel response caching and when do I need one?

A cache profile in Laravel response caching determines whether a request should be cached based on custom logic. Create custom cache profiles when you need fine-grained control over which specific requests or routes qualify for response caching.