---
title: "How DatoCMS solved tag invalidation with Turso"
description: "DatoCMS's Content Delivery API attaches cache tags to every response and sends invalidated tags to the frontend via webhook, but Next.js limits a cache item to 64 tags."
url: "https://swe.quest/articles/how-datocms-solved-tag-invalidation-with-turso-1cbed129b2d71763"
canonical: "https://turso.tech/blog/how-datocms-solved-tag-invalidation-with-turso"
source: "Turso"
published: "2024-07-15"
difficulty: "easy"
kind: "Case study"
reading_minutes: 3
tags: ["caching","sqlite","frontend"]
---

# How DatoCMS solved tag invalidation with Turso

A post on [Turso](https://swe.quest/sources/turso.md), published 2024-07-15, 3 min read, Case study. Original: [https://turso.tech/blog/how-datocms-solved-tag-invalidation-with-turso](https://turso.tech/blog/how-datocms-solved-tag-invalidation-with-turso)

## Summary

DatoCMS's Content Delivery API attaches cache tags to every response and sends invalidated tags to the frontend via webhook, but Next.js limits a cache item to 64 tags. To work around it, the DatoCMS Next.js starter stores query-identifier/cache-tag pairs in a single two-column Turso table and tags each page with only the query ID (a SHA1 digest). On invalidation, it looks up the affected queries, invalidates them, and deletes their rows. The writeup mainly promotes the starter and Turso's free plan, with only a brief sketch of the mechanism.

Written by swe.quest, not by the author.

**Difficulty:** Easy: no special background needed; explains what something is and why it matters

## Topics

- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [Frontend](https://swe.quest/tags/frontend.md) (Web & mobile)

## Prerequisites

- Next.js caching ([easy posts on React](https://swe.quest/tags/react.md?difficulty=easy))
- CDN cache invalidation ([easy posts on CDN & edge](https://swe.quest/tags/cdn-edge.md?difficulty=easy))

## Keywords

DatoCMS, Turso, Next.js, GraphQL, Cache Tags

## Related posts

- [Write that blog… with Turso!](https://swe.quest/articles/write-that-blog-with-turso-eb57ed9c715594d8.md): Turso · 2024-10-08 · Medium · 4 min read · SQLite, Databases, Frontend
  WriteThatBlog!, an aggregator of engineering blog posts tagged by writing pattern, is a single static HTML page on GitHub Pages that queries a replicated Turso database directly from the browser over HTTP, with no backend functions or proxies.
- [Use Turso as your Unkey cache store](https://swe.quest/articles/use-turso-as-your-unkey-cache-store-177ce1ca33005f50.md): Turso · 2024-08-01 · Medium · 2 min read · Caching, SQLite, TypeScript
  Turso can serve as the backing store for Unkey's \`@unkey/cache\` middleware library through its \`LibSQLStore\` adapter.
- [Incident 2023-12-04: Data leak and loss in some free tier databases](https://swe.quest/articles/incident-2023-12-04-data-leak-and-loss-in-some-free-tier-databases-f301d07a6ce79951.md): Turso · 2023-12-05 · Medium · 3 min read · Incidents & postmortems, Multi-tenancy, Storage systems, Security, Serverless
  A migration bug introduced on November 20 left 0.07% of Turso free-tier databases with an empty backup identifier, so they all pointed at a shared S3 prefix (s3://bucket//) instead of per-database paths.
- [Timeseries indexing at scale](https://swe.quest/articles/timeseries-indexing-at-scale-cbd6b9bd5fe12d35.md): Datadog Engineering · 2024-06-28 · Medium · 20 min read · Storage engines, Search, Databases, Observability, Scaling
  Datadog replaced its timeseries index, which auto-generated materialized indexes from a log of slow queries, with an inverted index that unconditionally indexes every metric;tag pair, much like search engines map words to documents.
- [Build your own Web Analytics Dashboard with Turso and Bolt](https://swe.quest/articles/build-your-own-web-analytics-dashboard-with-turso-and-bolt-74317d9f01cee8fc.md): Turso · 2024-12-03 · Medium · 4 min read · AI for coding, SQLite, Frontend, Analytics & OLAP
  Bolt can generate a Next.js 14 web analytics dashboard backed by a Turso database when you feed it the database schema and a detailed requirements prompt.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
