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

Problem with deleting entries #129

Open
mebibou opened this issue Jan 29, 2021 · 3 comments
Open

Problem with deleting entries #129

mebibou opened this issue Jan 29, 2021 · 3 comments

Comments

@mebibou
Copy link

mebibou commented Jan 29, 2021

I want to add a route that can be used to delete a cache entry, so that next time that specific cache route is called it will re-fetch the content.

However, it doesnt really work:

  1. I call the route /get/foo that is cached for 1h
  2. I delete the entry /get/foo: cache.del('/get/foo'). The callback return value says 1: OK
  3. I call the route /get/foo again, strangely the response code is 304 even though I deleted the cache entry
  4. I call the route /get/foo again, and again and again and it is always status 304
  5. If I try to delete again the cache entry with cache.del('/get/foo') it returns 0, event though I called that same endpoint multiple times after deleting the entry
  6. If I do cache.get((err, entries) => console.log(entries)) at that moment, it shows no entry

It seems after you delete an entry once, it just never shows again? we can never delete it again? or is it not how to delete entries manually?

@rawpixel-vincent
Copy link

304 means the content has not been modified, your issue is most likely not related to this library but to either a CDN in front of your origin, or the browser cache behavior, look into your http cache-control handling and into any CDN setup in front of your origin servers

@mebibou
Copy link
Author

mebibou commented Jul 17, 2021

I'm doing this in Postman

@rawpixel-vincent
Copy link

I believe postman would respect browser cache behavior 🤔
I can confirm after checking, currently working on this code base, that this library does not modify the status code response in any way, I might miss something but look into any middleware you have.
Can you share the request/response headers (before and after cache hit) ?

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

2 participants