MCPcopy Create free account
hub / github.com/directus/directus / setCacheValueWithExpiry

Function setCacheValueWithExpiry

api/src/cache.ts:171–179  ·  view source on GitHub ↗
(
	cache: Keyv,
	key: string,
	value: Record<string, any> | Record<string, any>[],
	ttl: number,
)

Source from the content-addressed store, hash-verified

169 * Store a value in cache with its expiration timestamp for TTL tracking
170 */
171export async function setCacheValueWithExpiry(
172 cache: Keyv,
173 key: string,
174 value: Record<string, any> | Record<string, any>[],
175 ttl: number,
176) {
177 await setCacheValue(cache, key, value, ttl);
178 await setCacheValue(cache, `${key}__expires_at`, { exp: Date.now() + ttl }, ttl);
179}
180
181/**
182 * Get a cached value along with its remaining TTL

Callers 2

listProviderProjectsMethod · 0.85
getProviderProjectMethod · 0.85

Calls 1

setCacheValueFunction · 0.85

Tested by

no test coverage detected