{"result":{"depiction_url":null,"edges":{"hasreference":{"objects":[{"created":"2026-10-07T11:13:35Z","object_id":{"id":1357,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_cache","title":"cache","uri":"https:\/\/zotonic.com\/id\/1357"},"seq":1}],"predicate":{"id":2774,"is_a":["meta","predicate"],"name":"hasreference","title":{"_type":"trans","tr":{"en":"Documentation reference"}},"uri":"https:\/\/zotonic.com\/id\/hasreference"}},"refers":{"objects":[{"created":"2026-10-07T11:13:08Z","object_id":{"id":1357,"is_a":["text","documentation","reference","template_tag"],"name":"doc_template_tag_tag_cache","title":"cache","uri":"https:\/\/zotonic.com\/id\/1357"},"seq":1000000},{"created":"2026-10-07T11:13:08Z","object_id":{"id":2979,"is_a":["text","documentation","developerguide"],"name":"developer_cache_debugging","title":{"_type":"trans","tr":{"en":"Distinguish stale cache data from stale code"}},"uri":"https:\/\/zotonic.com\/id\/2979"},"seq":1000000},{"created":"2026-10-07T11:13:08Z","object_id":{"id":2983,"is_a":["text","documentation","developerguide"],"name":"developer_testing_strategy","title":{"_type":"trans","tr":{"en":"Choose checks for a change"}},"uri":"https:\/\/zotonic.com\/id\/2983"},"seq":1000000}],"predicate":{"id":2409,"is_a":["meta","predicate"],"name":"refers","title":{"_type":"trans","tr":{"en":"Refers"}},"uri":"https:\/\/zotonic.com\/id\/refers"}},"subject":{"objects":[{"created":"2026-10-07T11:13:35Z","object_id":{"id":2554,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_how_to_guide","title":"How-to guide","uri":"https:\/\/zotonic.com\/id\/2554"},"seq":1},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":2},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2620,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_template","title":"Template","uri":"https:\/\/zotonic.com\/id\/2620"},"seq":3},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2630,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_cache","title":"Cache","uri":"https:\/\/zotonic.com\/id\/2630"},"seq":4},{"created":"2026-10-07T11:13:35Z","object_id":{"id":2688,"is_a":["categorization","keyword","keyword_quality"],"name":"zotonic_topic_performance","title":"Performance","uri":"https:\/\/zotonic.com\/id\/2688"},"seq":5}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2946,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2946"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"developer_template_cache","page_url":{"en":"https:\/\/zotonic.com\/docs\/2946\/cache-a-template-fragment","x-default":"https:\/\/zotonic.com\/docs\/2946\/cache-a-template-fragment"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>Check <a href=\"\/id\/1357\" class=\"doc-reference doc-reference-tag\"><code>tag#cache<\/code><\/a> for the supported duration, variation, and dependency arguments. A fragment containing a user&#39;s private information must not be shared between users through an incomplete cache key. Language and resource identity can also change the result.<\/p>\n<p>Test a cache hit, then change the underlying content and check invalidation. During debugging, the Development page can disable template cache tags. Restore that setting before measuring normal page behavior. See <a href=\"\/id\/2979\">Distinguish stale cache data from stale code<\/a> and <a href=\"\/id\/2983\">Choose checks for a change<\/a>.<\/p>\n<p>For a public resource card, a starting point is:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% cache 60 garden_card vary=id vary=z_language if_anonymous %}\n    &lt;a href=&quot;{{ id.page_url }}&quot;&gt;{{ id.title }}&lt;\/a&gt;\n{% endcache %}\n<\/code><\/pre>\n<p>The resource ID varies the entry and is a cache dependency; language separates translations. This example caches only anonymous requests. If the fragment also reads connected resources, add the corresponding dependencies. Rename a shared cache block when its output contract changes.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2026-10-07T11:12:56Z","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"doc_editorial_bundle":true,"doc_editorial_edges":{"hasreference":[1357],"subject":[2554,2563,2620,2630,2688]},"is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T20:45:39Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"developer_template_cache","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2026-10-07T11:12:56Z","slug":"cache-a-template-fragment","summary":{"_type":"trans","tr":{"en":"First measure the work performed by the fragment. Cache a fragment only when you know which inputs and data changes affect its output."}},"title":{"_type":"trans","tr":{"en":"Cache a template fragment"}},"title_slug":{"_type":"trans","tr":{"en":"cache-a-template-fragment"}},"tz":"UTC","uri":null,"version":20,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/2946","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2946"}},"status":"ok"}