{"action":"created","issue":{"url":"https://api.github.com/repos/BryanDonovan/node-cache-manager/issues/23","labels_url":"https://api.github.com/repos/BryanDonovan/node-cache-manager/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/BryanDonovan/node-cache-manager/issues/23/comments","events_url":"https://api.github.com/repos/BryanDonovan/node-cache-manager/issues/23/events","html_url":"https://github.com/BryanDonovan/node-cache-manager/issues/23","id":65108767,"number":23,"title":"Multiple requests during first cache","user":{"login":"gmaclennan","id":290457,"avatar_url":"https://avatars.githubusercontent.com/u/290457?v=3","gravatar_id":"","url":"https://api.github.com/users/gmaclennan","html_url":"https://github.com/gmaclennan","followers_url":"https://api.github.com/users/gmaclennan/followers","following_url":"https://api.github.com/users/gmaclennan/following{/other_user}","gists_url":"https://api.github.com/users/gmaclennan/gists{/gist_id}","starred_url":"https://api.github.com/users/gmaclennan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmaclennan/subscriptions","organizations_url":"https://api.github.com/users/gmaclennan/orgs","repos_url":"https://api.github.com/users/gmaclennan/repos","events_url":"https://api.github.com/users/gmaclennan/events{/privacy}","received_events_url":"https://api.github.com/users/gmaclennan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-29T23:55:17Z","updated_at":"2015-03-30T00:27:15Z","closed_at":null,"body":"How does the wrap function handle multiple concurrent requests to the same key when the value still is not cached? E.g.\r\n\r\n```js\r\nfunction getCachedUser(id, cb) {\r\n    memoryCache.wrap(id, function (cacheCallback) {\r\n        getUser(id, cacheCallback);\r\n    }, ttl, cb);\r\n}\r\n```\r\n\r\nIf `getUser()` takes 500ms to respond and you call `getCachedUser(123, cb)` 10 times before 500ms has passed, does it make 10 calls to `getUser()` because the value is not cached until the first `getUser()` returns?\r\n"},"comment":{"url":"https://api.github.com/repos/BryanDonovan/node-cache-manager/issues/comments/87502730","html_url":"https://github.com/BryanDonovan/node-cache-manager/issues/23#issuecomment-87502730","issue_url":"https://api.github.com/repos/BryanDonovan/node-cache-manager/issues/23","id":87502730,"user":{"login":"BryanDonovan","id":8901,"avatar_url":"https://avatars.githubusercontent.com/u/8901?v=3","gravatar_id":"","url":"https://api.github.com/users/BryanDonovan","html_url":"https://github.com/BryanDonovan","followers_url":"https://api.github.com/users/BryanDonovan/followers","following_url":"https://api.github.com/users/BryanDonovan/following{/other_user}","gists_url":"https://api.github.com/users/BryanDonovan/gists{/gist_id}","starred_url":"https://api.github.com/users/BryanDonovan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BryanDonovan/subscriptions","organizations_url":"https://api.github.com/users/BryanDonovan/orgs","repos_url":"https://api.github.com/users/BryanDonovan/repos","events_url":"https://api.github.com/users/BryanDonovan/events{/privacy}","received_events_url":"https://api.github.com/users/BryanDonovan/received_events","type":"User","site_admin":false},"created_at":"2015-03-30T00:27:15Z","updated_at":"2015-03-30T00:27:15Z","body":"I updated the test to make it a bit more realistic (make the first call slower than subsequent), just in case. https://github.com/BryanDonovan/node-cache-manager/commit/44b31ae761990fe61d670d32a97c200a798c3ed3"}}