Skip to content

IAkavacheConnection interface

Defined in

Namespace: Akavache.Reactive Assembly: Akavache.Reactive.dll Full name: Akavache.Reactive.IAkavacheConnection Modifiers: public abstract

Summary

Abstracts the database connection used by SQLite-backed blob caches. The surface is intentionally narrow and CacheEntry-specific so that implementations can bind parameters and cache prepared statements without going through reflection or an expression-tree translator.

Applies to

net10.0, net10.0-maccatalyst26.0, net10.0-desktop1.0, net10.0-browserwasm1.0, net10.0-tvos26.0, net10.0-windows10.0.19041, net10.0-macos26.0, net10.0-ios26.0, net10.0-android36.0, net9.0, net9.0-tvos18.0, net9.0-macos15.0, net9.0-maccatalyst18.0, net9.0-windows10.0.19041, net9.0-ios18.0, net9.0-desktop1.0, net8.0, net8.0-windows10.0.19041, net8.0-ios18.0, net8.0-maccatalyst18.0, net8.0-macos15.0, net8.0-tvos18.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.5, netstandard2.1, net481, net462, net471

Class hierarchy
classDiagram
class IAkavacheConnection
class IDisposable {
    <>
}
IDisposable <|.. IAkavacheConnection

Implements: IDisposable

Remarks

Every method returns IObservable rather than Task — this matches the observable-first shape of IBlobCache so the whole sqlite pipeline composes directly with Rx operators without Task/await bridges. Cancellation is expressed through subscription disposal: unsubscribing before an operation completes is the observable-native "cancel" signal. Note that operations already dequeued by the worker thread cannot be cancelled mid-sqlite3_step — SQLite has no per-statement cancel primitive.

Single-value reads (Get, TryReadLegacyV10Value, TableExists) emit exactly one value and then complete. Multi-value reads (GetMany, GetAll, GetAllKeys) emit one item per matching row and then complete; callers that want a materialized list can apply .ToList() at the boundary. Writers (Upsert, Invalidate, SetExpiry, etc.) emit a single Unit and then complete on success or OnError on failure.

Task-returning adapters live on IAkavacheConnectionTaskExtensions for callers that prefer async/await at the boundary — those are thin ToTask wrappers that do not take part in the hot path.

Methods

NameSummary
CreateSchemaCreates the CacheEntry table (and supporting indexes) if it does not already exist. Emits a single [Unit](# when the schema is ready.
TableExistsChecks whether a table with the specified name exists in the database. Emits a single Boolean.
GetReads a single cache entry by key, honouring expiration and an optional type filter. Emits exactly one value: the entry, or null when no matching row exists (or the row is expired).
GetManyReads every unexpired cache entry whose key is in keys. Emits one item per matching row, in no particular order, then completes.
GetAllReads every unexpired cache entry in the store, optionally filtered by type. Emits one item per row, then completes.
GetAllKeysReads every unexpired cache entry key, optionally filtered by type. Emits one item per key, then completes.
UpsertInserts or replaces a batch of cache entries within a single transaction. Emits a single [Unit](# on commit.
InvalidateDeletes cache entries by key within a single transaction. If a type discriminator is supplied, only rows whose [TypeName](# matches are removed. Emits a...
InvalidateAllRemoves every row from the CacheEntry table, optionally filtered by type. Emits a single [Unit](# on commit.
SetExpiryUpdates the expiration time of a cache entry by key, with an optional type filter. Emits a single [Unit](# on commit.
VacuumExpiredRemoves every row whose expiration is older than now. Emits a single [Unit](# on commit.
CheckpointRequests a WAL checkpoint at the specified strength. Backends with no write-ahead log should treat this as a no-op and emit [Unit](# immediately.
CompactRequests that the backend reclaim unused storage. On SQLite this maps to VACUUM. Emits a single [Unit](# on completion.
TryReadLegacyV10ValueAttempts to read a cache value from a V10 legacy backing store. Backends that do not support V10 legacy migration emit null. Emits exactly one value.