-
Notifications
You must be signed in to change notification settings - Fork 145
Closed
Labels
Description
For storing one-time reference items, such as OTP, it would be useful to have a method, say take, that would return the object and also delete it from the cache (so that any further get will result in undefined).
Something like below:
function take(key) {
const val = this.get(key);
if(val) this.delete(key);
return val;
}
While this can be easily done at the app-level, for stronger semantics it would be nice to have in the API itself, if possible.
Reactions are currently unavailable