Skip to main content

Type Alias: FetchStrategyCacheConfig

FetchStrategyCacheConfig = object

Defined in: packages/core/src/types.ts:90

Properties

afterGet()?

optional afterGet: <E, P, R>(options, data) => Promise<FetchResponse<R>>

Defined in: packages/core/src/types.ts:129

If set, this function will be executed after restoring data from cache (cache.get) and can be used to reconstruct things that were removed in beforeSet.

Type Parameters

E

E

P

P extends EndpointParams

R

R

Parameters

options

FetchStrategyCacheHandlerOptions<E, P, R>

data

FetchResponse<R>

Returns

Promise<FetchResponse<R>>


beforeSet()?

optional beforeSet: <E, P, R>(options, data) => Promise<FetchResponse<R>>

Defined in: packages/core/src/types.ts:117

If set, this function will be executed before calling the cache.set method It's useful if you want to remove things from the data before caching.

Type Parameters

E

E

P

P extends EndpointParams

R

R

Parameters

options

FetchStrategyCacheHandlerOptions<E, P, R>

data

FetchResponse<R>

Returns

Promise<FetchResponse<R>>


cacheHandler?

optional cacheHandler: FetchStrategyCacheHandler

Defined in: packages/core/src/types.ts:139

A custom cache handler implementation

If set will override the default in-memory cache handler


enabled?

optional enabled: boolean | <E, P, R>(options) => boolean

Defined in: packages/core/src/types.ts:103

Whether the cache should be enable globably or for a given fetchStrategy


ttl?

optional ttl: number | <E, P, R>(options) => number

Defined in: packages/core/src/types.ts:94

TTL in seconds