pub struct InstanceCache { /* private fields */ }Expand description
An owned duckdb_instance_cache (destroyed once on drop).
Deliberately !Send + !Sync: DuckDB gives no concurrency guarantee for a shared
instance cache, so a handle must stay on the thread that created it.
Implementations§
Source§impl InstanceCache
impl InstanceCache
Sourcepub fn new() -> InstanceCache
pub fn new() -> InstanceCache
Creates a new, empty instance cache.
Sourcepub fn get_or_create<P: AsRef<Path>>(
&self,
path: P,
config: Config,
) -> Result<Database>
pub fn get_or_create<P: AsRef<Path>>( &self, path: P, config: Config, ) -> Result<Database>
Opens the database at path through this cache: if a database for path
already exists in the cache it is returned (sharing the same instance),
otherwise a new one is created and cached. :memory: and an empty path both
mean an in-memory database.
The returned Database closes independently; the cache keeps its own
reference until dropped.
§Errors
Returns an error if the path contains an interior NUL or DuckDB fails to open the database (its error message is surfaced).
Trait Implementations§
Source§impl Default for InstanceCache
impl Default for InstanceCache
Source§impl Drop for InstanceCache
impl Drop for InstanceCache
Auto Trait Implementations§
impl !Send for InstanceCache
impl !Sync for InstanceCache
impl Freeze for InstanceCache
impl RefUnwindSafe for InstanceCache
impl Unpin for InstanceCache
impl UnsafeUnpin for InstanceCache
impl UnwindSafe for InstanceCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more