@blazedpath/commons 0.0.10 → 0.1.0
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/blz-base/index.js +893 -895
- package/blz-cache/index.js +25 -14
- package/blz-core/index.js +347 -349
- package/blz-cryptography/index.js +47 -49
- package/blz-datetimes/index.js +348 -350
- package/blz-file/index.js +83 -88
- package/blz-hazelcast/index.js +100 -103
- package/blz-iterable/index.js +404 -406
- package/blz-json-schema/index.js +6 -8
- package/blz-jwt/index.js +89 -92
- package/blz-kafka/index.js +105 -107
- package/blz-math/index.js +127 -129
- package/blz-mongodb/index.js +33 -35
- package/blz-rds/index.js +44 -46
- package/blz-rds-mysql/index.js +9 -11
- package/blz-rds-mysqlx/index.js +10 -12
- package/blz-rds-oracle/index.js +99 -104
- package/blz-rds-postgres/index.js +11 -13
- package/blz-redis/index.js +123 -125
- package/blz-regex/index.js +22 -24
- package/blz-strings/index.js +165 -167
- package/blz-uuid/index.js +2 -4
- package/blz-yaml/index.js +16 -19
- package/package.json +1 -1
package/blz-cache/index.js
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
const { lruCache } = require('./LruCache')
|
|
2
2
|
|
|
3
3
|
module.exports = typeof module.exports === "undefined" ? {} : module.exports;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Get cache item
|
|
6
|
+
* @param {string} key - key cache item
|
|
7
|
+
* @return {any}
|
|
8
|
+
*/
|
|
9
|
+
module.exports.localCacheGet = function( key ) {
|
|
10
|
+
return lruCache.get(key)
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Remove cache item
|
|
14
|
+
* @param {string} key - key cache item
|
|
15
|
+
* @return {any}
|
|
16
|
+
*/
|
|
17
|
+
module.exports.localCacheRemove = function( key ) {
|
|
18
|
+
lruCache.del(key)
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set cache item
|
|
22
|
+
* @param {string} key - key cache item
|
|
23
|
+
* @param {any} value - value of cache
|
|
24
|
+
* @param {integer} [expire] - expire time in milliseconds
|
|
25
|
+
* @return {any}
|
|
26
|
+
*/
|
|
27
|
+
module.exports.localCacheSet = function( key, value, expire ) {
|
|
28
|
+
lruCache.set(key, value, expire || 0)
|
|
18
29
|
}
|