# Local Iceberg Cache

> Cache the database's own Iceberg files on the device — not a second database.

The database **is** a set of Iceberg files on object storage, and the WASM engine already reads those exact files. So the client cache is not a new database — it is a byte cache of warehouse objects, sitting transparently underneath the engine.

## How it works

- **Immutable files cached forever** — Parquet and metadata objects never change, so they cache indefinitely.
- **One pointer read to revalidate** — a single read of the table pointer tells the cache whether a table changed.
- **Namespaced per identity** — on IndexedDB (web) or any key-value engine (React Native), keyed by Cognito `sub`.

## Revocation-driven deletion

Because every cached byte is tagged with the identity that fetched it, revoking access has a precise consequence: **every locally persisted byte that access fetched is deleted**. There is no orphaned copy in a second store because there is no second store.

```tsx title="app/_layout.tsx"
import { RAStackProvider } from "rastack/provider";

// The cache lives under the provider; it is transparent to your hooks.
<RAStackProvider mode="local">
  <App />
</RAStackProvider>
```

> **Tip:** The cache lives in `tools/cache` and ships as `rastack/cache`. Your hooks never touch it directly — it sits beneath the engine.

---

_Source: [https://reactapistack.com/docs/local-cache](https://reactapistack.com/docs/local-cache) · Full docs as one file: [llms-full.txt](https://reactapistack.com/llms-full.txt)_
