Skip to main content

Module cached

Module cached 

Source
Expand description

Two-tier cached storage backend implementation.

This module provides a caching layer on top of any storage backend:

  • Fast access to frequently used data
  • Write-through caching for consistency
  • Support for any StorageBackend as cache or store

§Configuration

The cached backend can be configured using the following options:

# Primary storage configuration
[engine]
engine = "adbc"
connection = "postgresql://localhost:5432"
options = {
    driver_path = "/usr/local/lib/libadbc_driver_postgresql.so",
    username = "postgres",
    database = "metrics"
}

# Cache configuration
[cache]
enabled = true
engine = "duckdb"
connection = ":memory:"
options = {
    threads = "2"
}

Or via command line:

hyprstream \
  --engine adbc \
  --engine-connection "postgresql://localhost:5432" \
  --engine-options driver_path=/usr/local/lib/libadbc_driver_postgresql.so \
  --engine-options username=postgres \
  --enable-cache \
  --cache-engine duckdb \
  --cache-connection ":memory:" \
  --cache-options threads=2

The implementation follows standard caching patterns while ensuring data consistency between cache and backing store.

Structs§

CachedStorageBackend
Two-tier storage backend with caching support.