1.0.3 • Published 5 years ago

firestore-cache v1.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Firestore-Cache

A Simple Wrapper npm-module to use Google Cloud Firestore DB with a Simple In-Memory Caching Mechanism enabled on requests and responses

How to use?

import { Database } from 'firestore-cache';

const db = new Database({
  serviceAccKeyFilePath: '../serviceAccountKey.json',
  cache_max_age: 4000,
  cache_allocated_memory: 100
});

Read one entry from a collection

const respond = await db.readOne({
  collection: collection,
  id: id
});

console.log(respond);

Read Multiple entries from a collection

const respond = await db.readMany({
  collection: collection
});

console.log(respond);

Write an entry to a collection

Leave id '' to generate a dyamic ID, or provide an id of your choice

const respond = await db.write({ id: '', collection }, documentData);

console.log(respond);
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago