pub struct InstanceCache { /* private fields */ }Expand description
RAII wrapper for a duckdb_instance_cache.
Automatically destroyed when dropped. Databases obtained from the cache remain valid until they are individually closed and the cache is dropped.
Implementations§
Source§impl InstanceCache
impl InstanceCache
Sourcepub fn get_or_create(
&self,
path: &CStr,
config: Option<&DbConfig>,
) -> Result<duckdb_database, ExtensionError>
pub fn get_or_create( &self, path: &CStr, config: Option<&DbConfig>, ) -> Result<duckdb_database, ExtensionError>
Opens path through the cache, creating the instance if it does not yet
exist or returning a handle to the cached one if it does.
Pass config to control how a freshly-created instance is configured; it
is ignored when an instance already exists for path.
The returned duckdb_database is owned by the caller and must be
closed with duckdb_close when no longer needed.
§Errors
Returns an ExtensionError carrying DuckDB’s message if the instance
cannot be opened or created.
Sourcepub const fn as_raw(&self) -> duckdb_instance_cache
pub const fn as_raw(&self) -> duckdb_instance_cache
Returns the raw handle.
Trait Implementations§
Source§impl Default for InstanceCache
impl Default for InstanceCache
Source§impl Drop for InstanceCache
impl Drop for InstanceCache
Auto Trait Implementations§
impl Freeze for InstanceCache
impl RefUnwindSafe for InstanceCache
impl !Send for InstanceCache
impl !Sync 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