Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memoized.delete() doesn't work for async #41

Closed
akuz opened this issue Apr 22, 2015 · 1 comment
Closed

memoized.delete() doesn't work for async #41

akuz opened this issue Apr 22, 2015 · 1 comment

Comments

@akuz
Copy link

akuz commented Apr 22, 2015

I have the following functions:

self.loadUrlText = function(url, callback) {
    d3.text(url, undefined, function(error, result) {
        callback(error, result);
    });
}

self.loadUrlPage = memoize(self.loadUrlText, {
    async: true,
    max: 100,
    maxAge: 1000 * 60 * 60
});

However after I call:

if (noCache) {
    alert('Uncache: ' + url);
    self.loadUrlPage.delete(url);
}

the memoized function still keeps returning the cached value without calling the underlying function.

@akuz
Copy link
Author

akuz commented Apr 22, 2015

Oh, sorry it was the browser cache! (Just put another alert into the loadUrlText() function)

@akuz akuz closed this as completed Apr 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant