From 029a85d9474a5bcf8d104f324e186be096ff54ba Mon Sep 17 00:00:00 2001 From: Bryan Donovan Date: Tue, 26 Jan 2016 12:30:45 -0800 Subject: [PATCH] promise example, history.md update for 1.3.0 --- History.md | 3 +++ README.md | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/History.md b/History.md index 0905757..614a16a 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,6 @@ +- 1.3.0 2016-01-26 + - Promise support (#39, #24) - @PuKoren + - 1.2.2 2015-10-19 - Bugfix: Fixing domain error issues when error is thrown inside 'work' function (#28). diff --git a/README.md b/README.md index 92553a0..f4a902b 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,17 @@ memoryCache.wrap(key, function (cb) { // { id: 123, name: 'Bob' } ``` +#### Example Using Promises + +```javascript +memoryCache.wrap(key, function() { + return getUserPromise(userId); +}); +then(function(user) { + console.log('User:', user); +}); +``` + Here's a very basic example of how you could use this in an Express app: ```javascript