Alokai

SetCacheProps

Properties for the setCache method.

interface SetCacheProps<TData> {
	data: () => Promise<TData>;
	key: string;
	tags?: (data: TData) => string[];
	timeToLive?: number;
}

Properties

NameRequiredTypeDescription
dataRequired() => Promise<TData>Callback returning the data to be stored in Redis.
keyRequiredstringThe key under which the data will be stored in Redis.
tagsOptional(data: TData) => string[]Callback returning the invalidation tags to be associated with the record's key in Redis.
timeToLiveOptionalnumberThe time in seconds after which the record will be deleted. Overrides the defaultTimeToLive option from the SDK module config.

On this page