Skip to main content

Fetching Cached Values

Retrieve previously stored values from your caches using ductape.cache.values().

Quick Example

const values = await ductape.cache.values({
cache_tag: 'api-responses',
product: 'my-app'
});

console.log(values);

How It Works

Query cached data by specifying filters like cache tag, component tag, or product tag. This is useful for reusing cached API responses or computed values across your application.

Examples

Fetch all values from a cache

const values = await ductape.cache.values({
cache_tag: 'user-data',
product: 'dashboard'
});

Filter by component

const values = await ductape.cache.values({
cache_tag: 'api-responses',
component_tag: 'fetch-user',
component_type: 'action',
product: 'my-app'
});

Filter non-expired values only

const values = await ductape.cache.values({
cache_tag: 'temp-data',
product: 'my-app',
expiry: new Date()
});

Response

[
{
"key": "user_123_result",
"value": "{\"score\":88}",
"cache_tag": "api-responses",
"product": "my-app",
"component_tag": "score_action",
"component_type": "action",
"expiry": "2025-05-01T00:00:00.000Z"
}
]
FieldDescription
keyUnique key for this cached value
valueThe cached value (typically stringified JSON)
cache_tagCache this value belongs to
productProduct where this value was stored
component_tagComponent that stored the value
component_typeType of component (action, event, etc.)
expiryExpiration date, if set

Reference

Filter Options

interface FetchRemoteCachePayload {
cache_tag: string;
product: string;
component_tag?: string;
component_type?: string;
expiry?: Date;
}

See Also