Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Choosing a cache mode

  • db.read_through_cache(&cache) serves what it can from the cache and goes to Firestore for the rest. This is the mode to reach for by default.
  • db.read_cached_only(&cache) never contacts Firestore. Reads by ID return None on a miss, and requests the cache cannot answer completely return an error.

Which operations use the cache:

OperationCached
Read by ID, batch read by IDsyes, for any cached collection
Listing all documents in a collectiononly for preloaded collections
Querying a collection (filtering, ordering, cursors)only for preloaded collections, and only for supported queries
Paged listing, queries with metadata, aggregations, transactions, writesnever