We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 107f617 + 57d9d4d commit 4c5eda1Copy full SHA for 4c5eda1
README.md
@@ -200,6 +200,22 @@ cache = caching({store: store, promiseDependency: Promise});
200
201
```
202
203
+#### Example Using async/await
204
+
205
+```javascript
206
207
+try {
208
+ let user = await memoryCache.wrap(key, function() {
209
+ return getUserPromise(userId);
210
+ });
211
+} catch (err) {
212
+ // error handling
213
+}
214
+```
215
216
+Hint: should wrap `await` call with `try` - `catch` to handle `promise` error.
217
218
219
#### Example Express App Usage
220
221
(Also see the [Express.js cache-manager example app](https://github.com/BryanDonovan/node-cache-manager-express-example)).
0 commit comments