-
Notifications
You must be signed in to change notification settings - Fork 545
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
[http-cache]: handle cache invalidation of location and content-location headers #3735
base: main
Are you sure you want to change the base?
Conversation
const result = this.#store.deleteByOriginAndPath(this.#requestOptions.origin, targetURL.pathname) | ||
// Fail silently if it is a promise/async function | ||
result && result.catch && result.catch(noop) | ||
} catch (err) { /* Fail silently */ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be awaited if it's a promise.
@Uzlopak What do you think about making this method more generic for calling it outside of the undici package. I have two suggestions:
|
const cachedPaths = this.#data.get(origin) | ||
for (const key of cachedPaths.keys()) { | ||
// not good to use startsWith here, but it's fine for now | ||
if (key.startsWith(path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would split the key
here by the :
because the MemoryCacheStore
indeed stores keys in a format path:method
, but this might be not true for other types of stores. So if someone will rely on this it might be a breaking change in the future.
this is a follow up to the follow up.