[{"data":1,"prerenderedAt":371},["ShallowReactive",2],{"docs-\u002Fcaching\u002F":3},{"id":4,"title":5,"body":6,"breadcrumb":327,"coderail":334,"dateModified":360,"datePublished":360,"description":361,"extension":362,"meta":363,"navigation":364,"next":360,"path":365,"prev":360,"schemaType":366,"seo":367,"stem":368,"wide":369,"__hash__":370},"docs\u002Fcaching.md","Caching",{"type":7,"value":8,"toc":318},"minimark",[9,18,23,34,49,53,70,73,84,88,91,142,145,163,167,174,238,290,296,300,306],[10,11,12,13,17],"p",{},"TagManifest caches parsed GTM containers for five minutes, keyed by container ID. The first scan of a given container fetches ",[14,15,16],"code",{},"gtm.js"," from the Google Tag Manager CDN and stores the parsed result. Later calls for the same container reuse that parse for up to five minutes instead of fetching again.",[19,20,22],"h2",{"id":21},"what-is-cached","What is cached",[10,24,25,26,30,31,33],{},"The cache stores the ",[27,28,29],"strong",{},"parsed container object"," — the structured representation of tags, triggers, variables, and metadata extracted from ",[14,32,16],{},". The raw JavaScript source is not stored. All rules run against the same data structure regardless of whether the response came from the CDN or the cache.",[10,35,36,37,40,41,44,45,48],{},"The cache is keyed by GTM container ID (e.g. ",[14,38,39],{},"GTM-EXAMPLE","). Two calls that resolve to the same container — one via ",[14,42,43],{},"url",", one via ",[14,46,47],{},"gtm_id"," directly — share the same cache entry.",[19,50,52],{"id":51},"ttl","TTL and expiry",[10,54,55,56,59,60,63,64,66,67,69],{},"A cache entry is reused for up to ",[27,57,58],{},"300 seconds (5 minutes)"," after it is written. Each write stores an ",[14,61,62],{},"expires_at"," timestamp. A read that finds an entry past its ",[14,65,62],{}," ignores it and fetches ",[14,68,16],{}," again. The new parse then replaces the old entry and starts a new five-minute window.",[10,71,72],{},"Expiry is checked when an entry is read. An expired entry is never used, but it is not deleted at the five-minute mark.",[10,74,75,76,79,80,83],{},"The 5-minute window matches how GTM publishes. Containers change only when someone explicitly publishes a new version. Five minutes covers normal iterative use — running ",[14,77,78],{},"scan_url"," then ",[14,81,82],{},"evaluate_rule"," against the same container. The cache does not check for a new publication. A version published inside the window is not picked up until the entry expires.",[19,85,87],{"id":86},"which-endpoints","Which endpoints use it",[10,89,90],{},"The cache is used whenever a container is resolved from a URL or a GTM ID:",[92,93,94,107],"table",{},[95,96,97],"thead",{},[98,99,100,104],"tr",{},[101,102,103],"th",{},"Surface",[101,105,106],{},"Uses the cache",[108,109,110,125],"tbody",{},[98,111,112,116],{},[113,114,115],"td",{},"REST",[113,117,118,121,122],{},[14,119,120],{},"POST \u002Fv1\u002Fscan-url",", ",[14,123,124],{},"POST \u002Fv1\u002Fevaluate-rule",[98,126,127,130],{},[113,128,129],{},"MCP",[113,131,132,121,134,121,136,121,139],{},[14,133,78],{},[14,135,82],{},[14,137,138],{},"get_health_score",[14,140,141],{},"compare_containers",[10,143,144],{},"All of these share one cache. A container fetched by a REST call is reused by an MCP call for the same GTM ID, and the other way round.",[10,146,147,148,151,152,154,155,158,159,162],{},"The cache is skipped when you pass the container yourself in ",[14,149,150],{},"data",". There is no ",[14,153,16],{}," fetch to save in that case. For the same reason ",[14,156,157],{},"POST \u002Fv1\u002Fscan"," and the ",[14,160,161],{},"scan_container"," tool never use the cache.",[19,164,166],{"id":165},"from-cache-field","from_cache field",[10,168,169,170,173],{},"The ",[14,171,172],{},"from_cache"," field says whether the parsed container came from the cache or from a fresh fetch. Where it sits depends on the surface:",[92,175,176,186],{},[95,177,178],{},[98,179,180,183],{},[101,181,182],{},"Call",[101,184,185],{},"Field",[108,187,188,200,211,226],{},[98,189,190,195],{},[113,191,192,193],{},"REST ",[14,194,120],{},[113,196,197],{},[14,198,199],{},"site.from_cache",[98,201,202,206],{},[113,203,192,204],{},[14,205,124],{},[113,207,208],{},[14,209,210],{},"container.from_cache",[98,212,213,222],{},[113,214,215,216,121,218,121,220],{},"MCP ",[14,217,78],{},[14,219,82],{},[14,221,138],{},[113,223,224],{},[14,225,210],{},[98,227,228,232],{},[113,229,215,230],{},[14,231,141],{},[113,233,234,235,237],{},"Not reported. The tool uses the cache but its result has no ",[14,236,172],{}," field.",[92,239,240,251],{},[95,241,242],{},[98,243,244,248],{},[101,245,246],{},[14,247,172],{},[101,249,250],{},"Meaning",[108,252,253,267,277],{},[98,254,255,260],{},[113,256,257],{},[14,258,259],{},"false",[113,261,262,263,266],{},"Container was freshly fetched from ",[14,264,265],{},"www.googletagmanager.com"," and parsed.",[98,268,269,274],{},[113,270,271],{},[14,272,273],{},"true",[113,275,276],{},"Container was served from the cache. Rules ran against the stored parse.",[98,278,279,284],{},[113,280,281],{},[14,282,283],{},"null",[113,285,286,287,289],{},"You passed the container in ",[14,288,150],{},", so nothing was fetched.",[10,291,292,293,295],{},"A cached parse skips the fetch from Google. The rules still run on every call, and a call made with a ",[14,294,43],{}," still fetches the page first to find the container ID.",[19,297,299],{"id":298},"implications","Implications",[10,301,302,305],{},[27,303,304],{},"A newly published version can take up to five minutes to show."," If you publish a new GTM version and scan straight away, the result may be based on the previous version. There is no option to skip the cache. Wait five minutes and scan again.",[10,307,308,311,312,314,315,317],{},[27,309,310],{},"Rate limits count cache hits the same as cache misses."," A ",[14,313,78],{}," call that returns a cached container still adds one to your daily ",[14,316,78],{}," count. The cache saves time, not calls.",{"title":319,"searchDepth":320,"depth":320,"links":321},"",2,[322,323,324,325,326],{"id":21,"depth":320,"text":22},{"id":51,"depth":320,"text":52},{"id":86,"depth":320,"text":87},{"id":165,"depth":320,"text":166},{"id":298,"depth":320,"text":299},[328,331,333],{"label":329,"href":330},"API Reference","\u002F",{"label":332},"Concepts",{"label":5},{"cards":335,"onpage":354},[336,344,349],{"title":337,"variant":338,"tabs":339},"Cache hit — REST scan-url (excerpt)","response",[340],{"label":341,"language":342,"code":343},"JSON","json","{\n  \"scanned_at\": \"2026-05-04T14:02:11.441Z\",\n  \"duration_ms\": 34,\n  \"site\": {\n    \"url\": \"https:\u002F\u002Fexample.com\",\n    \"gtm_id\": \"GTM-EXAMPLE\",\n    \"from_cache\": true\n  }\n}\n",{"title":345,"variant":338,"tabs":346},"MCP scan_url result (excerpt)",[347],{"label":341,"language":342,"code":348},"{\n  \"container\": {\n    \"gtm_id\": \"GTM-EXAMPLE\",\n    \"tag_count\": 85,\n    \"from_cache\": true\n  }\n}\n",{"title":350,"variant":338,"tabs":351},"Cache miss — first fetch",[352],{"label":341,"language":342,"code":353},"{\n  \"scanned_at\": \"2026-05-04T14:02:00.001Z\",\n  \"duration_ms\": 487,\n  \"site\": {\n    \"url\": \"https:\u002F\u002Fexample.com\",\n    \"gtm_id\": \"GTM-EXAMPLE\",\n    \"from_cache\": false\n  }\n}\n",[355,356,357,358,359],{"id":21,"label":22},{"id":51,"label":52},{"id":86,"label":87},{"id":165,"label":166},{"id":298,"label":299},null,"5-minute container cache keyed by GTM ID. Avoids re-fetching gtm.js on repeated calls to the same container.","md",{},true,"\u002Fcaching","TechArticle",{"title":5,"description":361},"caching",false,"vRyc0mIhINyDA-z56mWE6O1QBCl_6XYivl-Xt4xQsas",1796069482180]