Menu

I built a client-side cache in Rust and compiled it to WebAssembly
📰

I built a client-side cache in Rust and compiled it to WebAssembly

DEV Community: rust·JohnMark Banisilon·15 days ago
#pxgtBS8L
#devtorust#devto#dev#cache#user
Reading 0:00
15s threshold

I built Blaze Cache , a high-performance client-side caching library written in Rust and compiled to WebAssembly.

The goal was simple: make browser caching fast, predictable, and easy to integrate — without turning it into a heavy framework.

Why Wasm?

Most browser caches are pure JavaScript. That works, but I wanted:

More predictable performance

A cleaner core data structure

A single engine that multiple adapters could share

So the hot path (storage, TTL, tags, eviction) runs in Rust → Wasm. After initialization, get and set are fully synchronous.

What it supports

Synchronous reads and writes after init

SIEVE eviction

TTL + tag-based invalidation

Optional IndexedDB persistence

Typed event system

Adapters for:

Axios

fetch

TanStack Query

SWR

Example

ts import { createCache } from '@blaze-cache/core'

const cache = await createCache({ capacity: 1000 })

cache.set('user:42', { name: 'Ada' }, { ttlMs: 30_000, tags: ['user'] }) cache.get('user:42') cache.invalidateTags('user')

Enter fullscreen…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.