node-cache-helper
Advanced tools
+1
-1
| { | ||
| "name": "node-cache-helper", | ||
| "version": "0.0.2", | ||
| "version": "0.0.3", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/cache.js", |
+12
-0
@@ -19,2 +19,6 @@ # NodeCacheHelper | ||
| ## Notice | ||
| Key DO NOT contain `_` | ||
| ## Usage | ||
@@ -32,2 +36,10 @@ | ||
| let d = await instance.get('Videos') // d = A | ||
| // With Special Args | ||
| // split key with `_` and send them as args of function | ||
| async function getUser(id) { return id } | ||
| instance.register('User', (id) => singleflight.Do('User_' + id, () => getUser(id))) | ||
| let d1 = await instance.get('User_1') // d1 = 1 | ||
| let d2 = await instance.get('User_2') // d2 = 2 | ||
| let d3 = await instance.get('User_tmp') // d3 = tmp | ||
| ``` |
5331
7.89%44
37.5%