Skip to main content
Learn how to persist embeddings between restarts using storage adapters.
By default, VectoriaDB stores embeddings in memory. Use a storage adapter to persist them between server restarts.

Storage Adapters

Quick Start

src/storage-quickstart.ts

How Persistence Works

  1. Initialize: VectoriaDB checks for cached data
  2. Validate: Cache is validated against toolsHash, version, and modelName
  3. Load or Index: Valid cache is loaded; otherwise re-indexing occurs
  4. Save: Call saveToStorage() to persist changes

Cache Invalidation

VectoriaDB automatically invalidates the cache when documents change:
src/cache-invalidation.ts

Validation Checks

On initialize(), VectoriaDB checks:
  1. Does the cache file/key exist?
  2. Does toolsHash match?
  3. Does version match?
  4. Does modelName match?
If any check fails, the cache is invalidated and re-indexing occurs.

Manual Storage Operations

src/manual-storage.ts

Multi-Tenant Isolation

Use namespaces to isolate different indexes:
src/multi-tenant.ts

Choosing an Adapter

File Adapter

Single-server deployments

Redis Adapter

Multi-pod environments

Memory Adapter

Development and testing

Cache Invalidation

Advanced cache control

Deployment

Production configuration