Skip to main content

Module backend

Module backend 

Source
Expand description

Backend interface for cache implementors.

This module defines the trait that custom cache backends must implement, along with the entry type they operate on. Most callers should use LanceCache instead of interacting with backends directly.

§Migrating custom backends

Cache keys are opaque 16-byte values. Store InternalCacheKey::as_bytes directly instead of decomposing a logical prefix, key string, and Rust type name. The physical namespace must also include CACHE_KEY_FORMAT, so a future key protocol produces cold misses instead of aliases. Persistent or tiered backends can route serializable values with CacheCodec::type_id.

Prefix invalidation and key inventory are intentionally not part of this interface: one-way digests cannot support either operation without retaining the logical strings that fixed-size keys are designed to remove. Existing callers should migrate removed symbols as follows:

  • replace with_backend_and_prefix(backend, prefix) with LanceCache::with_backend followed by LanceCache::with_key_prefix;
  • replace invalidate_prefix with LanceCache::clear when clearing the shared backend is acceptable, or rotate a versioned namespace to leave older entries to age out;
  • remove uses of prefix, keys, and session key-inventory methods; opaque keys have no readable or enumerable equivalent.

Traits§

CacheBackend
Low-level pluggable cache backend.

Type Aliases§

CacheEntry
A type-erased cache entry.