-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
clearPrefetchCache Doesn't Always Work #771
Comments
Nice catch, I'll make sure this gets fixed for the next release. |
In case anyone wants to help out and submit a pull request, this is the line causing the issue. Regex characters in the prefix need to be escaped. That can be done with |
Just adding my 2 cents: clearPrefetchCache is quite misleading IMO, since it only clears the persistent cache for a specific url or cacheKey. I'm guessing that most users actually intend on blowing away the entire prefetch cache, and not that for a specific URL. Or at the very least, have an option to clear either. I propose adding a universal prefix such as __Bhound to the existing prefix, thus enabling clearing all prefetch entries from the cache. |
I disagree with that. If I were to call Still, it might be useful to prefix all keys with a universal bloodhound prefix so that you could do something like this. |
We're still talking about Bloodhound instances belonging to the same app, and the number of different prefetches over time could be huge, thus the need to clean every once in a while. Would be nice to have both options available. |
Fixed for v0.10.3. |
If the prefetch has no cacheKey and the URL contains special regex characters, such as '?' or '()', clearPrefetchCache has no effect.
In http://jsfiddle.net/8qass/4/ you can click on localStorage to list the keys, click on clearPrefetchCache to call the method, click on localStorage to see the keys are still there. However, if you give prefech a (regex safe) cacheKey, it works as expected.
The text was updated successfully, but these errors were encountered: