Created
December 10, 2019 11:04
-
-
Save oukayuka/9de3460161bf8100fc9c849fedb94547 to your computer and use it in GitHub Desktop.
Firestore のスナップショットをいい感じにキャッシュしてくれるライブラリの構想
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getByQuery, strategies } from 'firestore-snapbox'; | |
const maxEntries = 100; | |
const maxAgeSeconds = 60 * 60; | |
const expiredDate = new Date(2020, 0, 10, 15); | |
const snap = await getByQuery(query, strategies.CacheFirst, { maxEntries, maxAgeSeconds, expiredDate }); | |
const books = snap.docs.map(doc => { ...doc, id: doc.id } as Book); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment