deco-vtex-fetch-cache

Cache VTEX GET responses in memory with SWR semantics and LRU eviction.

5|2|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/decocms/deco-start --skill deco-vtex-fetch-cache
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: deco-vtex-fetch-cache
Source: https://github.com/decocms/deco-start/tree/main/.cursor/skills/deco-vtex-fetch-cache
Command: npx skills add https://github.com/decocms/deco-start --skill deco-vtex-fetch-cache

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides an in-memory SWR cache for VTEX GET requests to reduce duplicate network calls, lower latency, and ensure consistent data during SSR.

Core Features & Use Cases

  • In-memory SWR caching for VTEX GET endpoints to reduce redundant requests
  • In-flight deduplication with background refresh (stale-while-revalidate)
  • LRU eviction and HTTP-status-based TTL with integration to fetchWithCache and vtexCachedFetch

Quick Start

Start using vtexCachedFetch for your VTEX GET calls to enable in-memory caching with SWR semantics.

Frequently Asked Questions about deco-vtex-fetch-cache

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce duplicate VTEX GET requests during server-side rendering?

To reduce duplicate VTEX GET requests during server-side rendering (SSR), you can use an in-memory stale-while-revalidate (SWR) cache. It deduplicates in-flight requests and caches responses to lower network calls and latency.

What is stale-while-revalidate caching for VTEX API calls?

Stale-while-revalidate (SWR) caching for VTEX API calls serves cached data immediately while triggering a background refresh. This ensures consistent data during SSR and reduces latency for product catalog and intelligent search endpoints.

How do I cache VTEX product catalog and intelligent search responses in memory?

You can cache VTEX product catalog and intelligent search responses in memory by using the vtexCachedFetch function. This integrates SWR semantics, LRU eviction, and HTTP-status-based TTL directly into your GET calls.

Does the VTEX in-memory cache work with Deco apps?

Yes, the VTEX in-memory cache is designed specifically for Deco apps. It integrates directly with fetchWithCache and vtexCachedFetch to optimize GET requests for product catalogs, related products, and intelligent search endpoints.

What is the best way to handle cache eviction for VTEX GET endpoints?

The best way to handle cache eviction for VTEX GET endpoints is using an LRU (Least Recently Used) eviction policy combined with HTTP-status-based TTL. This ensures efficient memory usage and fresh data.

Why does my VTEX SSR fetch latency remain high despite caching?

VTEX SSR fetch latency may remain high if in-flight deduplication is not applied or if the cache TTL is misconfigured based on HTTP status. Using vtexCachedFetch with SWR semantics ensures proper background refresh and LRU eviction.