Expand description
Database instance cache (DuckDB 1.5.0+).
An InstanceCache lets multiple connections share a single underlying
DuckDB instance for a given database path. Opening the same path twice
through the cache returns handles backed by the same instance, which avoids
the “database is already open in another process/instance” conflict and saves
the cost of re-initialising the database.
This is primarily useful for extensions or host integrations that open secondary databases on behalf of a query.
§Example
use quack_rs::instance_cache::InstanceCache;
let cache = InstanceCache::new();
// Returns a duckdb_database the caller owns and must close with duckdb_close.
let db = cache.get_or_create(c"my.db", None)?;Structs§
- Instance
Cache - RAII wrapper for a
duckdb_instance_cache.