CachingDatabaseAdapter class

An adapter that enables caching of data (for example, in local memory).

Example

import 'package:database/database.dart';

void main() {
  final database = CachingDatabaseAdapter(
    master: BrowserDatabaseAdapter(),
    cache: MemoryDatabaseAdapter(),
  ).database();
}
Inheritance

Constructors

CachingDatabaseAdapter({@required DatabaseAdapter master, @required DatabaseAdapter cache, bool useCacheWhenMasterUnavailable: true})

Properties

cache DatabaseAdapter
Cache Database.
final
hashCode int
The hash code for this object. [...]
read-only, inherited
master DatabaseAdapter
Master Database.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
useCacheWhenMasterUnavailable bool
Whether to ignore UnavailableException from master and use cache results (or error) when this happen. The default is true.
final

Methods

close() Future<void>
Closes the database adapter.
inherited
database() Database
Returns the database.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
performCheckConnection({Duration timeout}) Future<void>
inherited
performDocumentBatch(DocumentBatchRequest request) Future<void>
inherited
performDocumentDelete(DocumentDeleteRequest request) Future<void>
override
performDocumentDeleteBySearch(DocumentDeleteBySearchRequest request) Future<void>
override
performDocumentInsert(DocumentInsertRequest request) Future<void>
inherited
performDocumentRead(DocumentReadRequest request) Stream<Snapshot>
override
performDocumentReadWatch(DocumentReadWatchRequest request) Stream<Snapshot>
inherited
performDocumentSearch(DocumentSearchRequest request) Stream<QueryResult>
override
performDocumentSearchChunked(DocumentSearchChunkedRequest request) Stream<QueryResult>
inherited
performDocumentSearchWatch(DocumentSearchWatchRequest request) Stream<QueryResult>
inherited
performDocumentTransaction(DocumentTransactionRequest request) Future<void>
override
performDocumentUpdate(DocumentUpdateRequest request) Future<void>
override
performDocumentUpdateBySearch(DocumentUpdateBySearchRequest request) Future<void>
override
performDocumentUpsert(DocumentUpsertRequest request) Future<void>
override
performExtension(DatabaseExtensionRequest<DatabaseExtensionResponse> request) Stream<DatabaseExtensionResponse>
inherited
performSchemaRead(SchemaReadRequest request) Stream<DatabaseSchema>
inherited
performSqlQuery(SqlQueryRequest request) Future<SqlIterator>
inherited
performSqlStatement(SqlStatementRequest request) Future<SqlStatementResult>
inherited
performSqlTransaction(SqlTransactionRequest request) Future<void>
inherited
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited