w-orm-lmdb 1.0.5 → 1.0.6
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/_db_cache/worm/users/data.mdb +0 -0
- package/_db_cache/worm/users/lock.mdb +0 -0
- package/dist/req-mingo.umd.js +1 -1
- package/dist/w-orm-lmdb.umd.js +2 -2
- package/dist/w-orm-lmdb.umd.js.map +1 -1
- package/docs/WOrmLmdb.html +47 -7
- package/docs/WOrmLmdb.mjs.html +15 -6
- package/docs/index.html +1 -1
- package/package.json +1 -1
- package/src/WOrmLmdb.mjs +14 -5
- package/test/basic.test.mjs +391 -397
- package/test/cache.test.mjs +168 -0
package/docs/WOrmLmdb.html
CHANGED
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
|
|
81
81
|
<dt class="tag-source">Source:</dt>
|
|
82
82
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
83
|
-
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#
|
|
83
|
+
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#line34">line 34</a>
|
|
84
84
|
</li></ul></dd>
|
|
85
85
|
|
|
86
86
|
|
|
@@ -336,6 +336,46 @@
|
|
|
336
336
|
</tr>
|
|
337
337
|
|
|
338
338
|
|
|
339
|
+
|
|
340
|
+
<tr>
|
|
341
|
+
|
|
342
|
+
<td class="name"><code>useCache</code></td>
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
<td class="type">
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
<span class="param-type">Boolean</span>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
</td>
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
<td class="attributes">
|
|
357
|
+
|
|
358
|
+
<optional><br>
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
</td>
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
<td class="default">
|
|
369
|
+
|
|
370
|
+
<code>false</code>
|
|
371
|
+
|
|
372
|
+
</td>
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
<td class="description last"><p>輸入是否使用select快取,適用於單程序操作,預設false</p></td>
|
|
376
|
+
</tr>
|
|
377
|
+
|
|
378
|
+
|
|
339
379
|
</tbody>
|
|
340
380
|
</table>
|
|
341
381
|
|
|
@@ -429,7 +469,7 @@
|
|
|
429
469
|
|
|
430
470
|
<dt class="tag-source">Source:</dt>
|
|
431
471
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
432
|
-
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#
|
|
472
|
+
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#line416">line 416</a>
|
|
433
473
|
</li></ul></dd>
|
|
434
474
|
|
|
435
475
|
|
|
@@ -590,7 +630,7 @@
|
|
|
590
630
|
|
|
591
631
|
<dt class="tag-source">Source:</dt>
|
|
592
632
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
593
|
-
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#
|
|
633
|
+
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#line531">line 531</a>
|
|
594
634
|
</li></ul></dd>
|
|
595
635
|
|
|
596
636
|
|
|
@@ -768,7 +808,7 @@
|
|
|
768
808
|
|
|
769
809
|
<dt class="tag-source">Source:</dt>
|
|
770
810
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
771
|
-
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#
|
|
811
|
+
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#line186">line 186</a>
|
|
772
812
|
</li></ul></dd>
|
|
773
813
|
|
|
774
814
|
|
|
@@ -929,7 +969,7 @@
|
|
|
929
969
|
|
|
930
970
|
<dt class="tag-source">Source:</dt>
|
|
931
971
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
932
|
-
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#
|
|
972
|
+
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#line289">line 289</a>
|
|
933
973
|
</li></ul></dd>
|
|
934
974
|
|
|
935
975
|
|
|
@@ -1216,7 +1256,7 @@
|
|
|
1216
1256
|
|
|
1217
1257
|
<dt class="tag-source">Source:</dt>
|
|
1218
1258
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1219
|
-
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#
|
|
1259
|
+
<a href="WOrmLmdb.mjs.html">WOrmLmdb.mjs</a>, <a href="WOrmLmdb.mjs.html#line132">line 132</a>
|
|
1220
1260
|
</li></ul></dd>
|
|
1221
1261
|
|
|
1222
1262
|
|
|
@@ -1393,7 +1433,7 @@
|
|
|
1393
1433
|
<br class="clear">
|
|
1394
1434
|
|
|
1395
1435
|
<footer>
|
|
1396
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
1436
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri May 15 2026 13:14:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1397
1437
|
</footer>
|
|
1398
1438
|
|
|
1399
1439
|
<script>prettyPrint();</script>
|
package/docs/WOrmLmdb.mjs.html
CHANGED
|
@@ -59,6 +59,7 @@ import isestr from 'wsemi/src/isestr.mjs'
|
|
|
59
59
|
import isarr from 'wsemi/src/isarr.mjs'
|
|
60
60
|
import isearr from 'wsemi/src/isearr.mjs'
|
|
61
61
|
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
62
|
+
import isbol from 'wsemi/src/isbol.mjs'
|
|
62
63
|
import haskey from 'wsemi/src/haskey.mjs'
|
|
63
64
|
import evem from 'wsemi/src/evem.mjs'
|
|
64
65
|
import genIDSeq from 'wsemi/src/genIDSeq.mjs'
|
|
@@ -74,6 +75,7 @@ import waitFun from 'wsemi/src/waitFun.mjs'
|
|
|
74
75
|
* @param {String} [opt.url='_db'] 輸入資料庫用資料夾字串,預設'_db'
|
|
75
76
|
* @param {String} [opt.db='worm'] 輸入使用資料庫名稱字串,預設'worm'
|
|
76
77
|
* @param {String} [opt.cl='test'] 輸入使用資料表名稱字串,預設'test'
|
|
78
|
+
* @param {Boolean} [opt.useCache=false] 輸入是否使用select快取,適用於單程序操作,預設false
|
|
77
79
|
* @returns {Object} 回傳操作資料庫物件,各事件功能詳見說明
|
|
78
80
|
*/
|
|
79
81
|
function WOrmLmdb(opt = {}) {
|
|
@@ -99,6 +101,12 @@ function WOrmLmdb(opt = {}) {
|
|
|
99
101
|
cl = 'test'
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
//useCache
|
|
105
|
+
let useCache = get(opt, 'useCache')
|
|
106
|
+
if (!isbol(useCache)) {
|
|
107
|
+
useCache = false
|
|
108
|
+
}
|
|
109
|
+
|
|
102
110
|
//storage
|
|
103
111
|
let storage = `${url}/${db}/${cl}`
|
|
104
112
|
// console.log('storage',storage)
|
|
@@ -117,7 +125,7 @@ function WOrmLmdb(opt = {}) {
|
|
|
117
125
|
let getData = async() => {
|
|
118
126
|
|
|
119
127
|
//check
|
|
120
|
-
if (isarr(_cache)) {
|
|
128
|
+
if (useCache && isarr(_cache)) {
|
|
121
129
|
return cloneDeep(_cache) //與外部使用數據脫勾
|
|
122
130
|
}
|
|
123
131
|
|
|
@@ -137,10 +145,11 @@ function WOrmLmdb(opt = {}) {
|
|
|
137
145
|
ltdt.push(dt)
|
|
138
146
|
}
|
|
139
147
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
148
|
+
if (useCache) {
|
|
149
|
+
_cache = ltdt
|
|
150
|
+
return cloneDeep(ltdt) //與外部使用數據脫勾
|
|
151
|
+
}
|
|
152
|
+
return ltdt
|
|
144
153
|
}
|
|
145
154
|
|
|
146
155
|
//getValue
|
|
@@ -699,7 +708,7 @@ export default WOrmLmdb
|
|
|
699
708
|
<br class="clear">
|
|
700
709
|
|
|
701
710
|
<footer>
|
|
702
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
711
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri May 15 2026 13:14:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
703
712
|
</footer>
|
|
704
713
|
|
|
705
714
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<br class="clear">
|
|
72
72
|
|
|
73
73
|
<footer>
|
|
74
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri May 15 2026 13:14:13 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|
package/package.json
CHANGED
package/src/WOrmLmdb.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import isestr from 'wsemi/src/isestr.mjs'
|
|
|
12
12
|
import isarr from 'wsemi/src/isarr.mjs'
|
|
13
13
|
import isearr from 'wsemi/src/isearr.mjs'
|
|
14
14
|
import iseobj from 'wsemi/src/iseobj.mjs'
|
|
15
|
+
import isbol from 'wsemi/src/isbol.mjs'
|
|
15
16
|
import haskey from 'wsemi/src/haskey.mjs'
|
|
16
17
|
import evem from 'wsemi/src/evem.mjs'
|
|
17
18
|
import genIDSeq from 'wsemi/src/genIDSeq.mjs'
|
|
@@ -27,6 +28,7 @@ import waitFun from 'wsemi/src/waitFun.mjs'
|
|
|
27
28
|
* @param {String} [opt.url='_db'] 輸入資料庫用資料夾字串,預設'_db'
|
|
28
29
|
* @param {String} [opt.db='worm'] 輸入使用資料庫名稱字串,預設'worm'
|
|
29
30
|
* @param {String} [opt.cl='test'] 輸入使用資料表名稱字串,預設'test'
|
|
31
|
+
* @param {Boolean} [opt.useCache=false] 輸入是否使用select快取,適用於單程序操作,預設false
|
|
30
32
|
* @returns {Object} 回傳操作資料庫物件,各事件功能詳見說明
|
|
31
33
|
*/
|
|
32
34
|
function WOrmLmdb(opt = {}) {
|
|
@@ -52,6 +54,12 @@ function WOrmLmdb(opt = {}) {
|
|
|
52
54
|
cl = 'test'
|
|
53
55
|
}
|
|
54
56
|
|
|
57
|
+
//useCache
|
|
58
|
+
let useCache = get(opt, 'useCache')
|
|
59
|
+
if (!isbol(useCache)) {
|
|
60
|
+
useCache = false
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
//storage
|
|
56
64
|
let storage = `${url}/${db}/${cl}`
|
|
57
65
|
// console.log('storage',storage)
|
|
@@ -70,7 +78,7 @@ function WOrmLmdb(opt = {}) {
|
|
|
70
78
|
let getData = async() => {
|
|
71
79
|
|
|
72
80
|
//check
|
|
73
|
-
if (isarr(_cache)) {
|
|
81
|
+
if (useCache && isarr(_cache)) {
|
|
74
82
|
return cloneDeep(_cache) //與外部使用數據脫勾
|
|
75
83
|
}
|
|
76
84
|
|
|
@@ -90,10 +98,11 @@ function WOrmLmdb(opt = {}) {
|
|
|
90
98
|
ltdt.push(dt)
|
|
91
99
|
}
|
|
92
100
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
if (useCache) {
|
|
102
|
+
_cache = ltdt
|
|
103
|
+
return cloneDeep(ltdt) //與外部使用數據脫勾
|
|
104
|
+
}
|
|
105
|
+
return ltdt
|
|
97
106
|
}
|
|
98
107
|
|
|
99
108
|
//getValue
|