@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.
@@ -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
- module.exports = {
7
- Backend: {
8
- localCacheGet: function( key ) {
9
- return lruCache.get(key)
10
- },
11
- localCacheRemove: function( key ) {
12
- lruCache.del(key)
13
- },
14
- localCacheSet: function( key, value, expire ) {
15
- lruCache.set(key, value, expire || 0)
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
  }