indexeddb-keyvalue 1.0.8 → 1.0.9
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.
- package/README.md +7 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# indexeddb-keyvalue
|
|
2
2
|
|
|
3
3
|
A lightweight IndexedDB wrapper with dual-layer caching (Memory + IndexedDB), table management, CRUD operations, and HTTP request caching.
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ A lightweight IndexedDB wrapper with dual-layer caching (Memory + IndexedDB), ta
|
|
|
16
16
|
|
|
17
17
|
## Performance Comparison
|
|
18
18
|
|
|
19
|
-
| Operation | Pure IndexedDB |
|
|
19
|
+
| Operation | Pure IndexedDB | indexeddb-keyvalue (Memory Cache) | Performance Boost |
|
|
20
20
|
|-----------|---------------|----------------------------------|-------------------|
|
|
21
21
|
| First Read | ~1-5ms | ~1-5ms | Same |
|
|
22
22
|
| Subsequent Reads | ~1-5ms | **~0.01ms** | **100-500x** |
|
|
@@ -27,7 +27,7 @@ A lightweight IndexedDB wrapper with dual-layer caching (Memory + IndexedDB), ta
|
|
|
27
27
|
## Installation
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npm install
|
|
30
|
+
npm install indexeddb-keyvalue
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
## Usage
|
|
@@ -37,7 +37,7 @@ npm install indexdb-cached-xhr
|
|
|
37
37
|
The simplest way to use it, with **built-in memory caching**, one line for high-performance data storage:
|
|
38
38
|
|
|
39
39
|
```javascript
|
|
40
|
-
import { CachedStorage } from '
|
|
40
|
+
import { CachedStorage } from 'indexeddb-keyvalue';
|
|
41
41
|
|
|
42
42
|
// Create storage instance (with dual-layer Memory + IndexedDB caching)
|
|
43
43
|
const storage = new CachedStorage('myDB', 'myTable');
|
|
@@ -73,7 +73,7 @@ storage.clearMemoryCache();
|
|
|
73
73
|
Automatically cache network request results:
|
|
74
74
|
|
|
75
75
|
```javascript
|
|
76
|
-
import { IndexedDBCachedFetch } from '
|
|
76
|
+
import { IndexedDBCachedFetch } from 'indexeddb-keyvalue';
|
|
77
77
|
|
|
78
78
|
const cachedFetch = new CachedFetch('cacheDB', 'apiCache');
|
|
79
79
|
|
|
@@ -99,7 +99,7 @@ const users = await cachedFetch.fetchJson('https://api.example.com/users', (data
|
|
|
99
99
|
Share database connections in multi-table scenarios for better resource efficiency:
|
|
100
100
|
|
|
101
101
|
```javascript
|
|
102
|
-
import { StorageFactory } from '
|
|
102
|
+
import { StorageFactory } from 'indexeddb-keyvalue';
|
|
103
103
|
|
|
104
104
|
// Get storage instances (global caching)
|
|
105
105
|
const userStorage = StorageFactory.getStorage('appDB', 'users');
|
|
@@ -127,7 +127,7 @@ StorageFactory.clearAllCache(); // Clear all caches
|
|
|
127
127
|
Use when more control is needed:
|
|
128
128
|
|
|
129
129
|
```javascript
|
|
130
|
-
import { TinyIndexDB } from '
|
|
130
|
+
import { TinyIndexDB } from 'indexeddb-keyvalue';
|
|
131
131
|
|
|
132
132
|
// Create instance
|
|
133
133
|
const db = new TinyIndexDB('myDatabase', 'id');
|
package/package.json
CHANGED