getCacheEvents
Create the cache event emitters and listeners for data changes, invalidation, and deletion.
import { getCacheEvents } from "@hyper-fetch/core"
Returns
| Name | Type | Description |
|---|---|---|
| emitCacheData | | Set cache data |
| emitDelete | | Delete of cache values |
| emitInvalidation | | Invalidate cache values event |
| onData | | Cache data listener for all keys |
| onDataByKey | | Cache data listener filtered by a specific cache key |
| onDelete | | Cache deletion listener for all keys |
| onDeleteByKey | | Cache deletion listener filtered by the cache key of the request.
Requests of every scope share that key - the callback receives the key of the deleted element
(
|
| onInvalidate | | Cache invalidation listener |
| onInvalidateByKey | | Cache invalidation listener filtered by the cache key of the request.
Requests of every scope share that key - the callback receives the key of the invalidated element
(
|
