A Simple Wrapper npm-module to use Google Cloud Firestore DB with a Simple In-Memory Caching Mechanism enabled on requests and responses
npm install firestore-cacheA Simple Wrapper npm-module to use Google Cloud Firestore DB with a Simple In-Memory Caching Mechanism enabled on requests and responses
``javascript
import { Database } from 'firestore-cache';
const db = new Database({
serviceAccKeyFilePath: '../serviceAccountKey.json',
cache_max_age: 4000,
cache_allocated_memory: 100
});
`
`javascript
const respond = await db.readOne({
collection: collection,
id: id
});
console.log(respond);
`
`javascript
const respond = await db.readMany({
collection: collection
});
console.log(respond);
`
Leave id '' to generate a dyamic ID, or provide an id of your choice
`javascript
const respond = await db.write({ id: '', collection }, documentData);
console.log(respond);
``