Events | laravel-responsecache | Spatie

 SPATIE

  Laravel Response Cache
=========================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-responsecache](https://spatie.be/docs/laravel-responsecache/v8)  Basic-usage  Events

 Version   v8

 Other versions for crawler [v8](https://spatie.be/docs/laravel-responsecache/v8)

  Events
- [ Introduction ](https://spatie.be/docs/laravel-responsecache/v8/introduction)
- [ Support us ](https://spatie.be/docs/laravel-responsecache/v8/support-us)
- [ Requirements ](https://spatie.be/docs/laravel-responsecache/v8/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-responsecache/v8/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-responsecache/v8/questions-issues)
- [ Changelog ](https://spatie.be/docs/laravel-responsecache/v8/changelog)
- [ About us ](https://spatie.be/docs/laravel-responsecache/v8/about-us)

Basic usage
-----------

- [ Caching responses ](https://spatie.be/docs/laravel-responsecache/v8/basic-usage/caching-responses)
- [ Flexible caching (SWR) ](https://spatie.be/docs/laravel-responsecache/v8/basic-usage/flexible-caching)
- [ Preventing caching ](https://spatie.be/docs/laravel-responsecache/v8/basic-usage/preventing-caching)
- [ Clearing the cache ](https://spatie.be/docs/laravel-responsecache/v8/basic-usage/clearing-the-cache)
- [ Using tags ](https://spatie.be/docs/laravel-responsecache/v8/basic-usage/using-tags)
- [ Events ](https://spatie.be/docs/laravel-responsecache/v8/basic-usage/events)

Advanced usage
--------------

- [ Custom cache profiles ](https://spatie.be/docs/laravel-responsecache/v8/advanced-usage/custom-cache-profiles)
- [ Creating a replacer ](https://spatie.be/docs/laravel-responsecache/v8/advanced-usage/creating-a-replacer)
- [ Customizing the serializer ](https://spatie.be/docs/laravel-responsecache/v8/advanced-usage/customizing-the-serializer)
- [ Customizing the hasher ](https://spatie.be/docs/laravel-responsecache/v8/advanced-usage/customizing-the-hasher)
- [ Configuration ](https://spatie.be/docs/laravel-responsecache/v8/advanced-usage/configuration)

 Events
======

###  On this page

1. [ ResponseCacheHitEvent ](#content-responsecachehitevent)
2. [ CacheMissedEvent ](#content-cachemissedevent)
3. [ ClearingResponseCacheEvent ](#content-clearingresponsecacheevent)
4. [ ClearedResponseCacheEvent ](#content-clearedresponsecacheevent)
5. [ ClearingResponseCacheFailedEvent ](#content-clearingresponsecachefailedevent)

There are several events you can use to monitor and debug response caching in your application.

ResponseCacheHitEvent
-----------------------------------------------------------------------------------------------------------------------

`Spatie\ResponseCache\Events\ResponseCacheHitEvent`

Fired when a cached response is found and returned. The event receives the `Request` object, the cache age in seconds, and the tags used.

CacheMissedEvent
--------------------------------------------------------------------------------------------------------

`Spatie\ResponseCache\Events\CacheMissedEvent`

Fired when no cached response is found for the request. The event receives the `Request` object.

ClearingResponseCacheEvent
--------------------------------------------------------------------------------------------------------------------------------------

`Spatie\ResponseCache\Events\ClearingResponseCacheEvent`

Fired when the response cache is about to be cleared.

ClearedResponseCacheEvent
-----------------------------------------------------------------------------------------------------------------------------------

`Spatie\ResponseCache\Events\ClearedResponseCacheEvent`

Fired after the response cache has been successfully cleared.

ClearingResponseCacheFailedEvent
--------------------------------------------------------------------------------------------------------------------------------------------------------

`Spatie\ResponseCache\Events\ClearingResponseCacheFailedEvent`

Fired when clearing the response cache fails.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
