Skip to content

Commit f4950e5

Browse files
committed
Add an endpoint to clear cached data by key
1 parent 46c634e commit f4950e5

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplyfire",
3-
"version": "0.5.4",
3+
"version": "0.5.5",
44
"scripts": {
55
"build": "ng build --configuration production",
66
"postbuild": "cp README.md dist",

packages/ngx/services/firestore.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,16 @@ export class FirestoreService extends AbstractFirestoreApi {
316316
return this.fetchFromCache(path, this.docValueChanges(path), maxAge);
317317
}
318318

319+
/**
320+
* @experimental
321+
*
322+
* Delete cached data from the memory
323+
*/
324+
deleteCache(path: string, qb?: QueryBuilder) {
325+
const key = path + (qb ? JSON.stringify(qb) : '');
326+
return this.cache.delete(key);
327+
}
328+
319329
private fetchFromCache(key: string, source: Observable<any>, maxAge: number) {
320330
const cached = this.cache.get(key);
321331

packages/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplyfire",
3-
"version": "0.5.4",
3+
"version": "0.5.5",
44
"license": "MIT",
55
"keywords": [
66
"firestore",

0 commit comments

Comments
 (0)