Back to Vercel

Interface: RuntimeCache

packages/functions/docs/interfaces/index.RuntimeCache.md

16.1.24.5 KB
Original Source

Interface: RuntimeCache

index.RuntimeCache

Interface representing the runtime cache.

Table of contents

Properties

Properties

delete

delete: (key: string) => Promise<void>

Type declaration

▸ (key): Promise<void>

Deletes a value from the cache.

Parameters
NameTypeDescription
keystringThe key of the value to delete.
Returns

Promise<void>

A promise that resolves when the value is deleted.

Defined in

packages/functions/src/cache/types.ts:11


expireTag

expireTag: (tag: string | string[]) => Promise<void>

Type declaration

▸ (tag): Promise<void>

Expires cache entries by tag.

Parameters
NameTypeDescription
tagstring | string[]The tag or tags of the cache entries to expire.
Returns

Promise<void>

A promise that resolves when the cache entries expiration request is received.

Defined in

packages/functions/src/cache/types.ts:44


get

get: (key: string) => Promise<unknown>

Type declaration

▸ (key): Promise<unknown>

Retrieves a value from the cache.

Parameters
NameTypeDescription
keystringThe key of the value to retrieve.
Returns

Promise<unknown>

A promise that resolves to the value, or null if not found.

Defined in

packages/functions/src/cache/types.ts:19


set

set: (key: string, value: unknown, options?: { name?: string ; tags?: string[] ; ttl?: number }) => Promise<void>

Type declaration

▸ (key, value, options?): Promise<void>

Sets a value in the cache.

Parameters
NameTypeDescription
keystringThe key of the value to set.
valueunknownThe value to set.
options?ObjectOptional settings for the cache entry.
options.name?stringOptional user-friendly name for the cache entry used for o11y.
options.tags?string[]Optional tags to associate with the cache entry.
options.ttl?numberOptional time-to-live for the cache entry, in seconds.
Returns

Promise<void>

A promise that resolves when the value is set.

Defined in

packages/functions/src/cache/types.ts:32