flamecache 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +14 -5
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![npm version](https://badge.fury.io/js/flamecache.svg)](https://www.npmjs.com/package/flamecache)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue)](https://www.typescriptlang.org/)
6
+ [![Bundle size](https://img.shields.io/bundlephobia/minzip/flamecache)](https://bundlephobia.com/package/flamecache)
6
7
  [![Tests](https://github.com/iamanishroy/flamecache/workflows/CI/badge.svg)](https://github.com/iamanishroy/flamecache/actions)
7
8
 
8
9
  > A Redis-like caching layer for Firebase Realtime Database with automatic expiration, counters, and batch operations.
@@ -12,7 +13,7 @@ Flamecache is a lightweight, robust caching solution that brings Redis-style ope
12
13
  ## ✨ Features
13
14
 
14
15
  - 🚀 **Redis-like API** - Familiar `get`, `set`, `incr`, `decr`, `expire` operations
15
- - ⚡ **Fast & Lightweight** - Only 5KB (bundled), no heavy dependencies
16
+ - ⚡ **Fast & Lightweight** - Only ~1KB (minified), no heavy dependencies
16
17
  - 🔄 **Auto-expiration** - Built-in TTL support with automatic cleanup
17
18
  - 📊 **Counters** - Atomic increment/decrement operations
18
19
  - 📦 **Batch Operations** - Multi-get, multi-set, multi-delete
@@ -126,6 +127,14 @@ Clear all cache entries.
126
127
  await cache.clear();
127
128
  ```
128
129
 
130
+ #### `disconnect(): Promise<void>`
131
+
132
+ Close the connection to Firebase. Crucial for Node.js scripts to exit cleanly.
133
+
134
+ ```typescript
135
+ await cache.disconnect();
136
+ ```
137
+
129
138
  ### Counter Operations
130
139
 
131
140
  #### `incr(key: string, by?: number): Promise<number>`
@@ -166,7 +175,7 @@ Get remaining time-to-live in seconds.
166
175
  - Returns remaining seconds otherwise
167
176
 
168
177
  ```typescript
169
- const remaining = await cache.ttl('session:abc');
178
+ const remaining = await cache.getTtl('session:abc');
170
179
  if (remaining > 0 && remaining < 300) {
171
180
  console.log('Session expiring soon!');
172
181
  }
@@ -483,7 +492,7 @@ const response = await cache.wrap<ApiResponse>('api:users', fetchUsers);
483
492
  ```json
484
493
  {
485
494
  "rules": {
486
- "cache": {
495
+ "flamecache": {
487
496
  ".read": true,
488
497
  ".write": true
489
498
  }
@@ -496,7 +505,7 @@ const response = await cache.wrap<ApiResponse>('api:users', fetchUsers);
496
505
  ```json
497
506
  {
498
507
  "rules": {
499
- "cache": {
508
+ "flamecache": {
500
509
  ".read": "auth != null",
501
510
  ".write": "auth != null"
502
511
  }
@@ -509,7 +518,7 @@ const response = await cache.wrap<ApiResponse>('api:users', fetchUsers);
509
518
  ```json
510
519
  {
511
520
  "rules": {
512
- "cache": {
521
+ "flamecache": {
513
522
  "users": {
514
523
  "$uid": {
515
524
  ".read": "$uid === auth.uid",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flamecache",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Simple and robust caching layer using Firebase Realtime Database",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -33,7 +33,7 @@
33
33
  "firebase",
34
34
  "cache",
35
35
  "caching",
36
- "redis-like",
36
+ "redis",
37
37
  "realtime-database"
38
38
  ],
39
39
  "author": "Anish Roy",