---
title: "Use Turso as your Unkey cache store"
description: "Turso can serve as the backing store for Unkey's `@unkey/cache` middleware library through its `LibSQLStore` adapter."
url: "https://swe.quest/articles/use-turso-as-your-unkey-cache-store-177ce1ca33005f50"
canonical: "https://turso.tech/blog/use-turso-as-your-unkey-cache-store"
source: "Turso"
published: "2024-08-01"
difficulty: "medium"
kind: "How-to"
reading_minutes: 2
tags: ["caching","sqlite","typescript"]
---

# Use Turso as your Unkey cache store

A post on [Turso](https://swe.quest/sources/turso.md), published 2024-08-01, 2 min read, How-to. Original: [https://turso.tech/blog/use-turso-as-your-unkey-cache-store](https://turso.tech/blog/use-turso-as-your-unkey-cache-store)

## Summary

Turso can serve as the backing store for Unkey's \`@unkey/cache\` middleware library through its \`LibSQLStore\` adapter. Setup takes four steps: install \`@unkey/cache\` and \`@libsql/client\`, create a \`cache\` table with key, value, freshUntil and staleUntil columns, pass a libSQL client to \`LibSQLStore\`, and register it in a cache namespace with fresh (60s) and stale (15m) windows. Pointing the client at an Embedded Replica (\`file:local.db\` with a \`syncUrl\`) keeps the cache next to the app to cut read latency.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Caching](https://swe.quest/tags/caching.md) (Backend & APIs)
- [SQLite](https://swe.quest/tags/sqlite.md) (Data & databases)
- [TypeScript](https://swe.quest/tags/typescript.md) (Languages)

## Prerequisites

- Node.js/npm ([easy posts on JavaScript](https://swe.quest/tags/javascript.md?difficulty=easy))
- basic SQL ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))

## Keywords

Turso, Unkey, @unkey/cache, libSQL, Embedded Replicas

## Related posts

- [Bringing SQLite to Vercel Functions with Turso](https://swe.quest/articles/bringing-sqlite-to-vercel-functions-with-turso-afed2a49c7b44020.md): Turso · 2026-02-19 · Medium · 8 min read · SQLite, Serverless, Replication, Multi-tenancy, JavaScript
  Turso's partial sync replicates a subset of SQLite database pages into Vercel Functions so reads run in-process with no network round-trip, while writes go to the remote Turso database for durability and consistency.
- [Toasty now fully supports Turso](https://swe.quest/articles/toasty-now-fully-supports-turso-b9805f71f7e75171.md): Turso · 2026-10-07 · Medium · 5 min read · Rust, SQLite, Local-first & sync, Serverless, Databases
  Toasty, the async Rust ORM from Tokio's creator, now supports Turso in three modes behind one API: local files with optional concurrent writes (transactions automatically wrapped in BEGIN CONCURRENT), a serverless remote mode over HTTP with URL and auth token, and local-first sync with explicit pull/push calls.
- [Introducing Databases Anywhere with Turso Sync](https://swe.quest/articles/introducing-databases-anywhere-with-turso-sync-0b3d82e805c07b9f.md): Turso · 2025-10-08 · Medium · 4 min read · Local-first & sync, SQLite, Replication, Identity & auth, JavaScript
  Turso Sync lets local SQLite-compatible Turso databases, in Node or in the browser via WASM, sync with Turso Cloud through push, pull and sync-aware checkpoint methods layered on the standard database API.
- [Introducing Offline Writes for Turso](https://swe.quest/articles/introducing-offline-writes-for-turso-e48bdc4a18b3aae7.md): Turso · 2024-10-25 · Easy · 4 min read · Local-first & sync, SQLite, Replication, Multi-tenancy
  Turso is opening a private beta for Offline Writes, letting applications write to local embedded SQLite replicas while online or offline and sync those changes to the cloud later.
- [Building Local-First Apps: The Complete Guide to Offline-First Database Sync](https://swe.quest/articles/building-local-first-apps-the-complete-guide-to-offline-first-database-sync-047687e423c4421f.md): Turso · 2026-07-27 · Medium · 9 min read · Local-first & sync, SQLite, Replication, Consistency models, TypeScript
  Turso Sync brings local-first behaviour to SQLite-based apps.

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)
